diff options
| author | Tharre <tharre3@gmail.com> | 2016-10-27 23:43:45 +0200 | 
|---|---|---|
| committer | Tharre <tharre3@gmail.com> | 2016-10-27 23:50:45 +0200 | 
| commit | 15465e8b518d9413c11dcdcad712a6a51b3ebde2 (patch) | |
| tree | f6fed48f65879e2d6be70fd602e2e61062a1ccb2 /src/dbg.h | |
| parent | d0b51f93d00c600d2c2e5480b1fd1d8d32bb1fdc (diff) | |
| download | redo-15465e8b518d9413c11dcdcad712a6a51b3ebde2.tar.gz redo-15465e8b518d9413c11dcdcad712a6a51b3ebde2.tar.xz redo-15465e8b518d9413c11dcdcad712a6a51b3ebde2.zip | |
Implement logging using REDO_DEBUG env variable
Diffstat (limited to 'src/dbg.h')
| -rw-r--r-- | src/dbg.h | 4 | 
1 files changed, 4 insertions, 0 deletions
| @@ -25,12 +25,16 @@  #define DEBUG 0  #endif +extern int DBG_LVL; +  /* helper functions which help in replacing the GNU extension ##__VA_ARGS__ */  #define STRINGIFY(x) #x  #define PREFIX(...) PREFIX_HELPER(_FILENAME, __LINE__, __VA_ARGS__)  #define SUFFIX(S, M, ...) M S, __VA_ARGS__  #define log_err(...) fprintf(stderr, PREFIX(__VA_ARGS__)) +#define log_warn(...) do { if (DBG_LVL > 2) log_err(__VA_ARGS__); } while (0) +#define log_info(...) do { if (DBG_LVL > 1) log_err(__VA_ARGS__); } while (0)  #define die(...) die_(PREFIX(__VA_ARGS__))  #define fatal(...) die(SUFFIX(": %s\n", __VA_ARGS__, strerror(errno))) | 
