aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-01-27 23:14:16 +0000
committerOmar Polo <op@omarpolo.com>2021-01-27 23:14:16 +0000
commit8904fa0e64ec12b5ca6f07f39c2d990bc557d701 (patch)
tree0cea3031da53fb9ee08d3a729857ee2211adc857
parent08a2fee055cc3d9f958b857765a3a6e60710ff26 (diff)
-v for verbose logging
-rw-r--r--gmid.14
-rw-r--r--gmid.c13
2 files changed, 14 insertions, 3 deletions
diff --git a/gmid.1 b/gmid.1
index 487afdd..ce05e50 100644
--- a/gmid.1
+++ b/gmid.1
@@ -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
diff --git a/gmid.c b/gmid.c
index 272a39d..09deac2 100644
--- a/gmid.c
+++ b/gmid.c
@@ -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 == '/')