3 * heavily inspired by previous work and Internet resources
5 * uses C99 variadic macros
6 * uses non-standard usage of the token-paste operator (##) for
7 * removing the comma symbol (,) when not followed by a token
8 * uses non-standard __FUNCTION__ macro (MSVC doesn't support __func__)
9 * tested on gcc 4.4.5 and Visual Studio 2008 (9.0), compiler version 15.00
11 * 2011, Razvan Deaconescu, razvan.deaconescu@cs.pub.ro
36 * initialize default loglevel (for dlog)
37 * may be redefined in the including code
41 #define LOG_LEVEL LOG_WARNING
45 * define DEBUG macro as a compiler option:
51 #define dprintf(format, ...) \
52 fprintf(stderr, " [%s(), %s:%u] " format, \
53 __FUNCTION__, __FILE__, __LINE__, \
56 #define dprintf(format, ...) \
62 #define dlog(level, format, ...) \
64 if (level <= LOG_LEVEL) \
65 dprintf(format, ##__VA_ARGS__); \
68 #define dlog(level, format, ...) \