From d2e40bb8d98763e33c3eeac4f5f1b7c53465009f Mon Sep 17 00:00:00 2001 From: Stefano Brivio Date: Tue, 15 Mar 2022 00:59:09 +0100 Subject: conf, util, tap: Implement --trace option for extra verbose logging --debug can be a bit too noisy, especially as single packets or socket messages are logged: implement a new option, --trace, implying --debug, that enables all debug messages. Signed-off-by: Stefano Brivio --- conf.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'conf.c') diff --git a/conf.c b/conf.c index 08f24be..5170163 100644 --- a/conf.c +++ b/conf.c @@ -558,6 +558,7 @@ static void usage(const char *name) info(""); info( " -d, --debug Be verbose, don't run in background"); + info( " --trace Be extra verbose, implies --debug"); info( " -q, --quiet Don't print informational messages"); info( " -f, --foreground Don't run in background"); info( " default: run in background if started from a TTY"); @@ -829,6 +830,7 @@ void conf(struct ctx *c, int argc, char **argv) {"no-dhcp-search", no_argument, NULL, 8 }, {"dns-forward", required_argument, NULL, 9 }, {"no-netns-quit", no_argument, NULL, 10 }, + {"trace", no_argument, NULL, 11 }, { 0 }, }; struct get_bound_ports_ns_arg ns_ports_arg = { .c = c }; @@ -960,6 +962,19 @@ void conf(struct ctx *c, int argc, char **argv) } c->no_netns_quit = 1; break; + case 11: + if (c->trace) { + err("Multiple --trace options given"); + usage(argv[0]); + } + + if (c->quiet) { + err("Either --trace or --quiet"); + usage(argv[0]); + } + + c->trace = c->debug = c->foreground = 1; + break; case 'd': if (c->debug) { err("Multiple --debug options given"); -- cgit v1.2.3