diff options
author | Alon Levy <alevy@redhat.com> | 2011-08-09 23:07:39 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-08-23 17:01:14 +0300 |
commit | fd684473fa8e61e755a4fdcc26935413a1742c74 (patch) | |
tree | b7d87b1684239251d17f07c08a7082f4f6ae4cec /common | |
parent | 2bddc6e33ce7803a2f15920270b8e6821557f7bc (diff) | |
download | spice-fd684473fa8e61e755a4fdcc26935413a1742c74.tar.gz spice-fd684473fa8e61e755a4fdcc26935413a1742c74.tar.xz spice-fd684473fa8e61e755a4fdcc26935413a1742c74.zip |
common: introduce red_printf_debug
Diffstat (limited to 'common')
-rw-r--r-- | common/spice_common.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/common/spice_common.h b/common/spice_common.h index 6c5154c1..51c6a684 100644 --- a/common/spice_common.h +++ b/common/spice_common.h @@ -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 |