diff options
author | FreeArtMan <dos21h@gmail.com> | 2014-11-16 11:10:23 +0900 |
---|---|---|
committer | FreeArtMan <dos21h@gmail.com> | 2014-11-16 11:10:23 +0900 |
commit | e8574a9621a2cbe50b22aa5aa8114bcebce22b38 (patch) | |
tree | 6e77d3872827926ce108f15e312d699fefbbd23a /debug.h | |
parent | c84cc88f0b34d8802390e2a7b6dab7f07ba277d1 (diff) | |
download | microbbs-e8574a9621a2cbe50b22aa5aa8114bcebce22b38.tar.gz microbbs-e8574a9621a2cbe50b22aa5aa8114bcebce22b38.zip |
Preparation to article list feature. Added debug.h and mmm.h
Diffstat (limited to 'debug.h')
-rw-r--r-- | debug.h | 65 |
1 files changed, 65 insertions, 0 deletions
@@ -0,0 +1,65 @@ +#ifndef __RB_DEBUG_UTILS_H +#define __RB_DEBUG_UTILS_H + +//what about kprintf? + +//config options +#define PRINTF printf +#define COLORIZE +#define PRINT_LINENUM +#define PRINT_FILENAME +#define PRINT_DEBUG + + +//use color +#ifdef COLORIZE + #define D_COLOR "1;32m" + #define D_COLOR_S "\033[" D_COLOR + #define D_COLOR_E "\033[0m" + #define E_COLOR "1;31m" + #define E_COLOR_S "\033[" E_COLOR + #define E_COLOR_E "\033[0m" +#else + #define D_COLOR + #define D_COLOR_S + #define D_COLOR_E + #define E_COLOR + #define E_COLOR_S + #define E_COLOR_E +#endif + +//print debug line +#ifdef PRINT_LINENUM + #define PRINT_LINE_F "LINE:%d " + #define PRINT_LINE_D __LINE__ +#else + #define PRINT_LINE_F "" + #define PRINT_LINE_D "" +#endif + +//print +#ifdef PRINT_FILENAME + #define PRINT_FILE_F "FILE:%s " + #define PRINT_FILE_D __FILE__ +#else + #define PRINT_FILE_F "" + #define PRINT_FILE_D "" +#endif + +//print debug string +#ifdef PRINT_DEBUG + #define PRINT_DEBUG_F "Debug: " +#else + #define PRINT_DEBUG_F "" +#endif + +#define PRINT( format, args ... ) PRINTF( D_COLOR_S PRINT_DEBUG_F \ + PRINT_FILE_F PRINT_LINE_F format D_COLOR_E, PRINT_FILE_D, \ + PRINT_LINE_D, ##args); + +#define ERROR( format, args ... ) PRINTF( E_COLOR_S PRINT_DEBUG_F \ + PRINT_FILE_F PRINT_LINE_F format E_COLOR_E, PRINT_FILE_D, \ + PRINT_LINE_D, ##args); + + +#endif |