summaryrefslogtreecommitdiff
path: root/src/internal.h
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2008-01-19 18:36:01 +0000
committerDaniel P. Berrange <berrange@redhat.com>2008-01-19 18:36:01 +0000
commite8d690aeb544dfa230e10d1d419a5a5cf594f869 (patch)
treef28a561680f5fd467cee7e1b9072d875c1e9a07b /src/internal.h
parent02b98afe293566b27949eefe53fd040dd50f7feb (diff)
downloadlibvirt-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.h13
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__