summaryrefslogtreecommitdiffstats
path: root/proxy/src/gp_debug.h
diff options
context:
space:
mode:
authorSimo Sorce <simo@redhat.com>2015-11-10 22:59:05 -0500
committerRobbie Harwood <rharwood@redhat.com>2015-12-01 17:33:42 -0500
commit71d316dfc51bcb9e18da61fb7299bb021523cde4 (patch)
treeac4046a1df6db33c293beee31c0fe190ddb2ab85 /proxy/src/gp_debug.h
parent0577e929ef896944b2f852f0c3071684e9b282aa (diff)
downloadgss-proxy-71d316dfc51bcb9e18da61fb7299bb021523cde4.tar.gz
gss-proxy-71d316dfc51bcb9e18da61fb7299bb021523cde4.tar.xz
gss-proxy-71d316dfc51bcb9e18da61fb7299bb021523cde4.zip
Add options to specify a debug level
Print only messages that are at that level or lower. Also add timestamps to debug messages. Signed-off-by: Simo Sorce <simo@redhat.com> Reviewed-by: Robbie Harwood <rharwood@redhat.com>
Diffstat (limited to 'proxy/src/gp_debug.h')
-rw-r--r--proxy/src/gp_debug.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/proxy/src/gp_debug.h b/proxy/src/gp_debug.h
index 7b665a1..b4dbf80 100644
--- a/proxy/src/gp_debug.h
+++ b/proxy/src/gp_debug.h
@@ -4,15 +4,25 @@
#define _GP_DEBUG_H_
#include <gssapi/gssapi.h>
+#include <stdarg.h>
#include <stdio.h>
+#include <time.h>
extern int gp_debug;
-void gp_debug_enable(void);
+void gp_debug_enable(int);
+void gp_debug_printf(const char *format, ...);
+void gp_debug_time_printf(const char *format, ...);
#define GPDEBUG(...) do { \
if (gp_debug) { \
- fprintf(stderr, __VA_ARGS__); \
+ gp_debug_time_printf(__VA_ARGS__); \
+ } \
+} while(0)
+
+#define GPDEBUGN(lvl, ...) do { \
+ if (lvl <= gp_debug) { \
+ gp_debug_time_printf(__VA_ARGS__); \
} \
} while(0)