diff options
author | Nick Mathewson <nickm@torproject.org> | 2019-10-08 13:13:31 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-10-17 12:01:40 -0400 |
commit | bfdfaae0405aa683cdae85bde58da742f4b59ae5 (patch) | |
tree | f008b3326861d896a85fdb1467058e2b506b6df9 /src/app/main/main.c | |
parent | c529b3f8f1d882b29c6b505de1a61d24c6a0943c (diff) | |
download | tor-bfdfaae0405aa683cdae85bde58da742f4b59ae5.tar.gz tor-bfdfaae0405aa683cdae85bde58da742f4b59ae5.zip |
Move responsibility for setting the "quiet level" into a table.
Previously this was done with a big list of options in main.c which
implied "hush" or "quiet". One of these options ("--digests") no
longer existed, but we still checked for it.
Now we use the table of command-line-only arguments to set this
value.
Diffstat (limited to 'src/app/main/main.c')
-rw-r--r-- | src/app/main/main.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/src/app/main/main.c b/src/app/main/main.c index ad8253cc7e..95dccbee64 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -547,40 +547,22 @@ tor_init(int argc, char *argv[]) hs_init(); { - /* We search for the "quiet" option first, since it decides whether we - * will log anything at all to the command line. */ + /* We check for the "quiet"/"hush" settings first, since they decide + whether we log anything at all to stdout. */ parsed_cmdline_t *cmdline; - const config_line_t *cl = NULL; cmdline = config_parse_commandline(argc, argv, 1); - if (cmdline != NULL) { - cl = cmdline->cmdline_opts; - } - for (; cl; cl = cl->next) { - if (!strcmp(cl->key, "--hush")) - quiet = 1; - if (!strcmp(cl->key, "--quiet") || - !strcmp(cl->key, "--dump-config")) - quiet = 2; - /* The following options imply --hush */ - if (!strcmp(cl->key, "--version") || !strcmp(cl->key, "--digests") || - !strcmp(cl->key, "--list-torrc-options") || - !strcmp(cl->key, "--library-versions") || - !strcmp(cl->key, "--list-modules") || - !strcmp(cl->key, "--hash-password") || - !strcmp(cl->key, "-h") || !strcmp(cl->key, "--help")) { - if (quiet < 1) - quiet = 1; - } - } + if (cmdline) + quiet = cmdline->quiet_level; parsed_cmdline_free(cmdline); } /* give it somewhere to log to initially */ switch (quiet) { case 2: - /* no initial logging */ + /* --quiet: no initial logging */ break; case 1: + /* --hush: log at warning or higher. */ add_temp_log(LOG_WARN); break; default: |