pdbg
Abstract
pdbg
prints debug information.
pdbg
はデバッグ情報を出力します.
Header file
namespace sstd{
inline void pdbg(...){}
inline void pdbg_if(...){}
inline void pdbg_if_exit(...){}
inline void pdbg_if_stop_exit(...){}
inline void dbg(...){}
inline void ndbg(...){}
}
Description
Function name | Description |
---|---|
pdbg() | A function to print debug messages with file name, function name and line number. デバッグメッセージ出力用の関数.呼び出したファイルの名前,関数名,行数とエラーメッセージを出力する. |
pdbg_if() | |
pdbg_if_exit() | |
pdbg_if_stop_exit() | |
dbg() | |
ndbg() |
Usage
pdbg
- main.cpp
#include <sstd/sstd.hpp> int main(){ sstd::pdbg("ERROR: printing error message.\n"); printf("\n"); std::string fileName = "NotExistingFile.txt"; sstd::file fp; if(!fp.fopen(fileName, "rb")){ sstd::pdbg("ERROR: fopen is failed. \"%s\" is not exist!\n", fileName.c_str()); return -1; } return 0; }
- Execution result
NOTE1:
[1m[31m.././tmp/.._._docs_src_docs_src_print_pdbg.md_44.cpp/.._._docs_src_docs_src_print_pdbg.md_44.cpp:4 main(): [0mERROR: printing error message. [1m[31m.././tmp/.._._docs_src_docs_src_print_pdbg.md_44.cpp/.._._docs_src_docs_src_print_pdbg.md_44.cpp:9 main(): [0mERROR: fopen is failed. "NotExistingFile.txt" is not exist!
The above output path is complex because the compile path for this file is complex.
上記で複雑なパスが出力されるのは,このファイルをコンパイルするパスが複雑なためです.
NOTE2:
[31m
treat as red on the terminal.
[31m
は端末上で赤色として扱われます.
pdbg_if
- main.cpp
#include <sstd/sstd.hpp> int main(){ printf("True: "); sstd::pdbg_if(true, "ERROR: printing error message.\n"); printf("False: "); sstd::pdbg_if(false, "ERROR: printing error message.\n"); printf("\n"); return 0; }
- Execution result
NOTE1:
True: [1m[31m.././tmp/.._._docs_src_docs_src_print_pdbg.md_69.cpp/.._._docs_src_docs_src_print_pdbg.md_69.cpp:4 main(): [0mERROR: printing error message. False:
The above output path is complex because the compile path for this file is complex.
上記で複雑なパスが出力されるのは,このファイルをコンパイルするパスが複雑なためです.
NOTE2:
[31m
treat as red on the terminal.
[31m
は端末上で赤色として扱われます.
Implementation
- Source: header only
- Header: sstd/src/print/pdbg.hpp
- Test: test/src_test/print/pdbg.cpp