diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2008-01-19 18:36:01 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2008-01-19 18:36:01 +0000 |
commit | e8d690aeb544dfa230e10d1d419a5a5cf594f869 (patch) | |
tree | f28a561680f5fd467cee7e1b9072d875c1e9a07b /src/internal.h | |
parent | 02b98afe293566b27949eefe53fd040dd50f7feb (diff) | |
download | libvirt-e8d690aeb544dfa230e10d1d419a5a5cf594f869.tar.gz |
Enable debug by default, but only if LIBVIRT_DEBUG=1. Use generic macro for debug output
Diffstat (limited to 'src/internal.h')
-rw-r--r-- | src/internal.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/internal.h b/src/internal.h index 50842cb1e7..b30b874126 100644 --- a/src/internal.h +++ b/src/internal.h @@ -54,6 +54,19 @@ extern "C" { #define STRNEQLEN(a,b,n) (strncmp((a),(b),(n)) != 0) #define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0) + +/* If configured with --enable-debug=yes then library calls + * are printed to stderr for debugging. + */ +#ifdef ENABLE_DEBUG +extern int debugFlag; +#define VIR_DEBUG(category, fmt,...) \ + do { if (debugFlag) fprintf (stderr, "DEBUG: %s: %s (" fmt ")\n", category, __func__, __VA_ARGS__); } while (0) +#else +#define VIR_DEBUG(category, fmt,...) + do { } while (0) +#endif /* !ENABLE_DEBUG */ + /* C99 uses __func__. __FUNCTION__ is legacy. */ #ifndef __GNUC__ #define __FUNCTION__ __func__ |