diff options
author | Omar Polo <op@omarpolo.com> | 2021-01-27 23:14:16 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-01-27 23:14:16 +0000 |
commit | 8904fa0e64ec12b5ca6f07f39c2d990bc557d701 (patch) | |
tree | 0cea3031da53fb9ee08d3a729857ee2211adc857 | |
parent | 08a2fee055cc3d9f958b857765a3a6e60710ff26 (diff) |
-v for verbose logging
-rw-r--r-- | gmid.1 | 4 | ||||
-rw-r--r-- | gmid.c | 13 |
2 files changed, 14 insertions, 3 deletions
@@ -23,7 +23,7 @@ .Op Fl fn .Op Fl c Ar config | -.Op Fl 6h +.Op Fl 6hv .Op Fl d Pa certs-dir .Op Fl H Ar hostname .Op Fl p Ar port @@ -88,6 +88,8 @@ would be automatically generated. Print the usage and exit. .It Fl p Ar port The port to listen on, by default 1965. +.It Fl v +Increase the verbosity of the logs. .It Fl x Pa path Enable execution of CGI scripts. See the description of the @@ -32,7 +32,7 @@ struct vhost hosts[HOSTSLEN]; -int exfd, foreground; +int exfd, foreground, verbose; struct conf conf; @@ -65,6 +65,11 @@ logs(int priority, struct client *c, int ec; va_list ap; + if (foreground && !verbose) { + if (priority == LOG_DEBUG || priority == LOG_INFO) + return; + } + va_start(ap, fmt); if (c == NULL) { @@ -476,7 +481,7 @@ main(int argc, char **argv) init_config(); - while ((ch = getopt(argc, argv, "6c:d:fH:hnp:x:")) != -1) { + while ((ch = getopt(argc, argv, "6c:d:fH:hnp:vx:")) != -1) { switch (ch) { case '6': conf.ipv6 = 1; @@ -514,6 +519,10 @@ main(int argc, char **argv) configless = 1; break; + case 'v': + verbose = 1; + break; + case 'x': /* drop the starting / (if any) */ if (*optarg == '/') |