Use DLOG/ELOG-macros, provide --verbose-option

This commit is contained in:
Axel Wagner
2010-09-17 06:49:28 +02:00
parent ca1a295714
commit 920721bb93
8 changed files with 83 additions and 66 deletions

View File

@ -3,6 +3,7 @@
typedef struct config_t {
int hide_on_modifier;
int verbose;
} config_t;
config_t config;

View File

@ -44,3 +44,14 @@
walk = TAILQ_FIRST(l); \
} \
} while (0)
/* Use cool logging-macros */
#define DLOG(fmt, ...) do { \
if (config.verbose) { \
printf("[%s:%d] " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} \
} while(0)
#define ELOG(fmt, ...) do { \
fprintf(stderr, "[%s:%d] ERROR: " fmt, __FILE__, __LINE__, ##__VA_ARGS__); \
} while(0)