From 9d132fbde6e776f2c4f18772deffa2a90faa7975 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 27 Mar 2008 17:25:49 +0000 Subject: [PATCH] Add --hush switch. New --hush command-line option similar to --quiet. While --quiet disables all logging to the console on startup, --hush limits the output to messages of warning and error severity. svn:r14222 --- ChangeLog | 3 +++ src/common/log.c | 4 ++-- src/common/log.h | 2 +- src/or/config.c | 3 ++- src/or/main.c | 17 +++++++++++++---- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index e663d0ff40..0cfa8edd3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -47,6 +47,9 @@ Changes in version 0.2.1.1-alpha - 2008-??-?? this accounted for over 40% of allocations from within Tor's code on a typical directory cache. - Lots of new unit tests. + - New --hush command-line option similar to --quiet. While --quiet + disables all logging to the console on startup, --hush limits the + output to messages of warning and error severity. o Code simplifications and refactoring: - Refactor code using connection_ap_handshake_attach_circuit() to diff --git a/src/common/log.c b/src/common/log.c index 0f59a93ac2..e49cc84116 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -535,10 +535,10 @@ init_logging(void) * logs are initialized). */ void -add_temp_log(void) +add_temp_log(int min_severity) { log_severity_list_t *s = tor_malloc_zero(sizeof(log_severity_list_t)); - set_log_severity_config(LOG_NOTICE, LOG_ERR, s); + set_log_severity_config(min_severity, LOG_ERR, s); LOCK_LOGS(); add_stream_log_impl(s, "", stdout); tor_free(s); diff --git a/src/common/log.h b/src/common/log.h index c752d40b85..2204ad1c72 100644 --- a/src/common/log.h +++ b/src/common/log.h @@ -130,7 +130,7 @@ int add_callback_log(log_severity_list_t *severity, log_callback cb); int get_min_log_level(void); void switch_logs_debug(void); void logs_free_all(void); -void add_temp_log(void); +void add_temp_log(int min_severity); void close_temp_logs(void); void rollback_log_changes(void); void mark_logs_temp(void); diff --git a/src/or/config.c b/src/or/config.c index 10ddf590c5..0672342c26 100644 --- a/src/or/config.c +++ b/src/or/config.c @@ -1343,7 +1343,8 @@ config_get_commandlines(int argc, char **argv, config_line_t **result) } else if (!strcmp(argv[i],"--list-fingerprint") || !strcmp(argv[i],"--verify-config") || !strcmp(argv[i],"--ignore-missing-torrc") || - !strcmp(argv[i],"--quiet")) { + !strcmp(argv[i],"--quiet") || + !strcmp(argv[i],"--hush")) { i += 1; /* command-line option. ignore it. */ continue; } else if (!strcmp(argv[i],"--nt-service") || diff --git a/src/or/main.c b/src/or/main.c index 9f6bff67f6..4ff46461ff 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -1780,12 +1780,21 @@ tor_init(int argc, char *argv[]) /* We search for the "quiet" option first, since it decides whether we * will log anything at all to the command line. */ for (i=1;i