diff --git a/libsurfman/src/surfman.h b/libsurfman/src/surfman.h index b4cf9be..f09f2c6 100644 --- a/libsurfman/src/surfman.h +++ b/libsurfman/src/surfman.h @@ -53,9 +53,21 @@ extern "C" void surfman_message(surfman_loglvl level, const char *fmt, ...) __attribute__ ((format (printf, 2, 3))); void surfman_vmessage(surfman_loglvl level, const char *fmt, va_list ap); # define __log(level, level_string, fmt, ...) \ - surfman_message(level, "%s:%s:%s:%d: " fmt "\n", level_string, __FILE__, __PRETTY_FUNCTION__, __LINE__, ## __VA_ARGS__) + surfman_message(level, "%s: " fmt "\n", level_string, ## __VA_ARGS__) + +# ifdef NDEBUG +# define SURFMAN_DEBUG_PRINT 0 +# else +# define SURFMAN_DEBUG_PRINT 1 +#endif + +# define surfman_debug(fmt, ...) \ + do { \ + if (SURFMAN_DEBUG_PRINT) \ + surfman_message(SURFMAN_DEBUG, "%s:%s:%d: " fmt, \ + __FILE__, __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); \ + } while (0) -# define surfman_debug(fmt, ...) __log(SURFMAN_DEBUG, "Debug", fmt, ## __VA_ARGS__) # define surfman_info(fmt, ...) __log(SURFMAN_INFO, "Info", fmt, ## __VA_ARGS__) # define surfman_warning(fmt, ...) __log(SURFMAN_WARNING, "Warning", fmt, ## __VA_ARGS__) # define surfman_error(fmt, ...) __log(SURFMAN_ERROR, "Error", fmt, ## __VA_ARGS__) diff --git a/surfman/src/ioemugfx.c b/surfman/src/ioemugfx.c index 3e674ae..fd946a2 100644 --- a/surfman/src/ioemugfx.c +++ b/surfman/src/ioemugfx.c @@ -105,7 +105,7 @@ ioemugfx_display_get_info(void *priv, int align; uint16_t rounded_xres; - surfman_info ("DisplayID:%d", msg->DisplayID); + surfman_debug ("DisplayID:%d", msg->DisplayID); m = display_get_monitor (msg->DisplayID); if (!m) { @@ -123,12 +123,12 @@ ioemugfx_display_get_info(void *priv, */ rounded_xres = out->max_xres & ~0x7; if (rounded_xres != out->max_xres) { - surfman_info ("Monitor %d: Rounding down xres: %d -> %d", + surfman_debug ("Monitor %d: Rounding down xres: %d -> %d", msg->DisplayID, out->max_xres, rounded_xres); out->max_xres = rounded_xres; } - surfman_info ("Monitor %d: Max resolution: %dx%d, stride alignment: %d", + surfman_debug ("Monitor %d: Max resolution: %dx%d, stride alignment: %d", msg->DisplayID, out->max_xres, out->max_yres, out->align); return 0;