diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-28 22:41:51 +0200 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2023-06-28 22:57:48 +0200 |
commit | f409cddcf9bb7f2684776902b38eaeddadede7ca (patch) | |
tree | 8d1a5295c6987563dc2bf6db400c7f770da933ba /src/worker_main.c | |
parent | test: skip ci.sh w/ Valgrind (diff) | |
download | cimple-f409cddcf9bb7f2684776902b38eaeddadede7ca.tar.gz cimple-f409cddcf9bb7f2684776902b38eaeddadede7ca.zip |
log: support logging levels
Diffstat (limited to 'src/worker_main.c')
-rw-r--r-- | src/worker_main.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/worker_main.c b/src/worker_main.c index 1bb3289..227f9a9 100644 --- a/src/worker_main.c +++ b/src/worker_main.c @@ -7,6 +7,7 @@ #include "cmd_line.h" #include "const.h" +#include "log.h" #include "worker.h" #include <getopt.h> @@ -20,7 +21,7 @@ static struct settings default_settings(void) const char *get_usage_string(void) { - return "[-h|--help] [-V|--version] [-H|--host HOST] [-p|--port PORT]"; + return "[-h|--help] [-V|--version] [-v|--verbose] [-H|--host HOST] [-p|--port PORT]"; } static int parse_settings(struct settings *settings, int argc, char *argv[]) @@ -32,12 +33,13 @@ static int parse_settings(struct settings *settings, int argc, char *argv[]) static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, + {"verbose", no_argument, 0, 'v'}, {"host", required_argument, 0, 'H'}, {"port", required_argument, 0, 'p'}, {0, 0, 0, 0}, }; - while ((opt = getopt_long(argc, argv, "hVH:p:", long_options, &longind)) != -1) { + while ((opt = getopt_long(argc, argv, "hVvH:p:", long_options, &longind)) != -1) { switch (opt) { case 'h': exit_with_usage(0); @@ -45,6 +47,9 @@ static int parse_settings(struct settings *settings, int argc, char *argv[]) case 'V': exit_with_version(); break; + case 'v': + g_log_lvl = LOG_LVL_DEBUG; + break; case 'H': settings->host = optarg; break; |