aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/client_main.c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-06-28 22:41:51 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-06-28 22:57:48 +0200
commitf409cddcf9bb7f2684776902b38eaeddadede7ca (patch)
tree8d1a5295c6987563dc2bf6db400c7f770da933ba /src/client_main.c
parenttest: skip ci.sh w/ Valgrind (diff)
downloadcimple-f409cddcf9bb7f2684776902b38eaeddadede7ca.tar.gz
cimple-f409cddcf9bb7f2684776902b38eaeddadede7ca.zip
log: support logging levels
Diffstat (limited to 'src/client_main.c')
-rw-r--r--src/client_main.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/client_main.c b/src/client_main.c
index 1969952..0a417d9 100644
--- a/src/client_main.c
+++ b/src/client_main.c
@@ -8,6 +8,7 @@
#include "client.h"
#include "cmd_line.h"
#include "const.h"
+#include "log.h"
#include <getopt.h>
#include <unistd.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;