common: introduce red_printf_debug

This commit is contained in:
Alon Levy 2011-08-09 23:07:39 +03:00 committed by Marc-André Lureau
parent e5b2086eb5
commit ed77ce6dbf

View File

@ -65,4 +65,14 @@
} \
} while (0)
#define red_printf_debug(debug, format, ...) do { \
static int debug_level = -1; \
if (debug_level == -1) { \
debug_level = getenv("SPICE_DEBUG_LEVEL") != NULL ? atoi(getenv("SPICE_DEBUG_LEVEL")) : 0; \
} \
if (debug >= debug_level) { \
printf("%s: " format "\n", __FUNCTION__, ## __VA_ARGS__ ); \
} \
} while(0)
#endif