diff --git a/src/debug.h b/src/debug.h index 9c5ec37b3..5d5f62a5b 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1 +1,19 @@ /* #define DEBUG */ +/* #define VERBOSE */ + +/* +* Enable verbose logging if requested on platforms that support it. +* +* Verbose logging adds metadata to printf, including the source file location +* from where printf was called and the time it was called at runtime. +*/ +#if defined(DEBUG) && defined(VERBOSE) && defined(__GNUC__) +#include +#include + +#define printf(args...) do { \ + time_t now = time(NULL); \ + printf("\n### %s, %d @ %s", __FILE__, __LINE__, ctime(&now)); \ + printf(args); \ +} while(0) +#endif