/*
* Geeqie
- * Copyright (C) 2008 The Geeqie Team
+ * Copyright (C) 2008 - 2012 The Geeqie Team
*
* Authors: Vladimir Nadvornik, Laurent Monin
*
* This software comes with no warranty of any kind, use at your own risk!
*/
-#ifndef DEBUG_H
-#define DEBUG_H
+#ifndef _DEBUG_H
+#define _DEBUG_H
-#if 1 /* set to 0 to disable compilation of debugging code and related options */
-# ifndef DEBUG
-# define DEBUG 1
-# endif
-#endif
+#include <glib.h>
+
+#define DOMAIN_DEBUG "debug"
+#define DOMAIN_INFO "info"
+
+void log_domain_printf(const gchar *domain, const gchar *format, ...) G_GNUC_PRINTF(2, 3);
+#define log_printf(...) log_domain_printf(DOMAIN_INFO, __VA_ARGS__)
#ifdef DEBUG
gint debug_level = get_debug_level(); \
if (debug_level >= (n)) \
{ \
- if (debug_level != 1) printf("%s:%d: ", __FILE__, __LINE__); \
- printf(__VA_ARGS__); \
- putchar('\n'); \
+ if (debug_level != 1) log_domain_printf(DOMAIN_DEBUG, "%s:%d: ", __FILE__, __LINE__); \
+ log_domain_printf(DOMAIN_DEBUG, __VA_ARGS__); \
+ log_domain_printf(DOMAIN_DEBUG, "\n"); \
} \
} while (0)
#define DEBUG_4(...) DEBUG_N(4, __VA_ARGS__)
-#endif /* DEBUG_H */
+#endif /* _DEBUG_H */
+/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */