From 71d316dfc51bcb9e18da61fb7299bb021523cde4 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 10 Nov 2015 22:59:05 -0500 Subject: 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 Reviewed-by: Robbie Harwood --- proxy/src/gssproxy.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'proxy/src/gssproxy.c') diff --git a/proxy/src/gssproxy.c b/proxy/src/gssproxy.c index 1e99f88..bcf236b 100644 --- a/proxy/src/gssproxy.c +++ b/proxy/src/gssproxy.c @@ -149,6 +149,7 @@ int main(int argc, const char *argv[]) int opt_interactive = 0; int opt_version = 0; int opt_debug = 0; + int opt_debug_level = 0; verto_ctx *vctx; verto_ev *ev; int wait_fd; @@ -168,8 +169,10 @@ int main(int argc, const char *argv[]) _("Specify a custom default socket"), NULL}, \ {"debug", 'd', POPT_ARG_NONE, &opt_debug, 0, \ _("Enable debugging"), NULL}, \ - {"version", '\0', POPT_ARG_NONE, &opt_version, 0, \ - _("Print version number and exit"), NULL }, \ + {"debug-level", '\0', POPT_ARG_INT, &opt_debug_level, 0, \ + _("Set debugging level"), NULL}, \ + {"version", '\0', POPT_ARG_NONE, &opt_version, 0, \ + _("Print version number and exit"), NULL }, \ POPT_TABLEEND }; @@ -189,8 +192,8 @@ int main(int argc, const char *argv[]) return 0; } - if (opt_debug) { - gp_debug_enable(); + if (opt_debug || opt_debug_level > 0) { + gp_debug_enable(opt_debug_level); } if (opt_daemon && opt_interactive) { -- cgit