diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2010-01-11 06:40:15 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2010-01-11 06:40:15 +0000 |
commit | ef71cd3fc87017bde947092f6497a6bed6c41732 (patch) | |
tree | a6e9c52da3ff2d91df0a87f766a66e5fe7f6a267 /usr.sbin/relayctl | |
parent | a47132c529785bf8305ce4c99000eebf7ecf2209 (diff) |
add "log brief" and "log verbose" to change logging verbosity
like several other things in the tree.
ok reyk@ looks fine claudio@
Diffstat (limited to 'usr.sbin/relayctl')
-rw-r--r-- | usr.sbin/relayctl/parser.c | 10 | ||||
-rw-r--r-- | usr.sbin/relayctl/parser.h | 6 | ||||
-rw-r--r-- | usr.sbin/relayctl/relayctl.c | 15 |
3 files changed, 26 insertions, 5 deletions
diff --git a/usr.sbin/relayctl/parser.c b/usr.sbin/relayctl/parser.c index b723e83143b..7c0634db9c7 100644 --- a/usr.sbin/relayctl/parser.c +++ b/usr.sbin/relayctl/parser.c @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.c,v 1.22 2009/11/13 20:09:54 jsg Exp $ */ +/* $OpenBSD: parser.c,v 1.23 2010/01/11 06:40:14 jsg Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -64,6 +64,7 @@ static const struct token t_host[]; static const struct token t_rdr_id[]; static const struct token t_table_id[]; static const struct token t_host_id[]; +static const struct token t_log[]; static const struct token t_main[] = { {KEYWORD, "monitor", MONITOR, NULL}, @@ -74,6 +75,7 @@ static const struct token t_main[] = { {KEYWORD, "redirect", NONE, t_rdr}, {KEYWORD, "table", NONE, t_table}, {KEYWORD, "host", NONE, t_host}, + {KEYWORD, "log", NONE, t_log}, {ENDTOKEN, "", NONE, NULL} }; @@ -123,6 +125,12 @@ static const struct token t_host_id[] = { {ENDTOKEN, "", NONE, NULL} }; +static const struct token t_log[] = { + {KEYWORD, "verbose", LOG_VERBOSE, NULL}, + {KEYWORD, "brief", LOG_BRIEF, NULL}, + {ENDTOKEN, "", NONE, NULL} +}; + static struct parse_result res; struct parse_result * diff --git a/usr.sbin/relayctl/parser.h b/usr.sbin/relayctl/parser.h index e3b3b944025..492e5454a92 100644 --- a/usr.sbin/relayctl/parser.h +++ b/usr.sbin/relayctl/parser.h @@ -1,4 +1,4 @@ -/* $OpenBSD: parser.h,v 1.11 2009/11/13 20:09:54 jsg Exp $ */ +/* $OpenBSD: parser.h,v 1.12 2010/01/11 06:40:14 jsg Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -33,7 +33,9 @@ enum actions { SHUTDOWN, POLL, RELOAD, - MONITOR + MONITOR, + LOG_VERBOSE, + LOG_BRIEF }; struct parse_result { diff --git a/usr.sbin/relayctl/relayctl.c b/usr.sbin/relayctl/relayctl.c index ceb4db920ac..389f12488d5 100644 --- a/usr.sbin/relayctl/relayctl.c +++ b/usr.sbin/relayctl/relayctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: relayctl.c,v 1.40 2009/09/01 08:51:34 claudio Exp $ */ +/* $OpenBSD: relayctl.c,v 1.41 2010/01/11 06:40:14 jsg Exp $ */ /* * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@openbsd.org> @@ -102,7 +102,7 @@ main(int argc, char *argv[]) struct imsg imsg; int ctl_sock; int done = 0; - int n; + int n, verbose = 0; /* parse options */ if ((res = parse(argc - 1, argv + 1)) == NULL) @@ -184,6 +184,15 @@ main(int argc, char *argv[]) case MONITOR: imsg_compose(ibuf, IMSG_CTL_NOTIFY, 0, 0, -1, NULL, 0); break; + case LOG_VERBOSE: + verbose = 2; + /* FALLTHROUGH */ + case LOG_BRIEF: + imsg_compose(ibuf, IMSG_CTL_LOG_VERBOSE, 0, 0, -1, + &verbose, sizeof(verbose)); + printf("logging request sent.\n"); + done = 1; + break; } while (ibuf->w.queued) @@ -224,6 +233,8 @@ main(int argc, char *argv[]) done = show_command_output(&imsg); break; case NONE: + case LOG_VERBOSE: + case LOG_BRIEF: break; case MONITOR: done = monitor(&imsg); |