[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tor/master] Make --quiet and --hush apply to default logs, not only initial logs
commit e5e7b6d71835841f037841ea60cb4f39b554b892
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date: Thu Aug 4 14:23:51 2011 -0400
Make --quiet and --hush apply to default logs, not only initial logs
Fixes bug 3550; bugfix on 0.2.0.10-alpha (where --quiet was introduced).
---
changes/bug3550 | 5 +++++
src/or/config.c | 11 +++++++++--
src/or/main.c | 7 +++++++
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/changes/bug3550 b/changes/bug3550
new file mode 100644
index 0000000..658179f
--- /dev/null
+++ b/changes/bug3550
@@ -0,0 +1,5 @@
+ o Minor bugfixes:
+ - The "--quiet" and "--hush" options now apply not only to Tor's
+ behavior before user-configured logs are added, but also to
+ Tor's behavior in the absense of configured logs. Fixes bug
+ 3550; bugfix on 0.2.0.10-alpha.
diff --git a/src/or/config.c b/src/or/config.c
index 088617b..ddce958 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -40,6 +40,9 @@
#include "procmon.h"
+/* From main.c */
+extern int quiet_level;
+
/** Enumeration of types which option values can take */
typedef enum config_type_t {
CONFIG_TYPE_STRING = 0, /**< An arbitrary string. */
@@ -3095,8 +3098,12 @@ options_validate(or_options_t *old_options, or_options_t *options,
"misconfigured or something else goes wrong.");
/* Special case on first boot if no Log options are given. */
- if (!options->Logs && !options->RunAsDaemon && !from_setconf)
- config_line_append(&options->Logs, "Log", "notice stdout");
+ if (!options->Logs && !options->RunAsDaemon && !from_setconf) {
+ if (quiet_level == 0)
+ config_line_append(&options->Logs, "Log", "notice stdout");
+ else if (quiet_level == 1)
+ config_line_append(&options->Logs, "Log", "warn stdout");
+ }
if (options_init_logs(options, 1)<0) /* Validate the log(s) */
REJECT("Failed to validate Log options. See logs for details.");
diff --git a/src/or/main.c b/src/or/main.c
index 54e6451..260de16 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -154,6 +154,12 @@ int can_complete_circuit=0;
* they are obsolete? */
#define TLS_HANDSHAKE_TIMEOUT (60)
+/** Decides our behavior when no logs are configured/before any
+ * logs have been configured. For 0, we log notice to stdout as normal.
+ * For 1, we log warnings only. For 2, we log nothing.
+ */
+int quiet_level = 0;
+
/********* END VARIABLES ************/
/****************************************************************************
@@ -2148,6 +2154,7 @@ tor_init(int argc, char *argv[])
default:
add_temp_log(LOG_NOTICE);
}
+ quiet_level = quiet;
log(LOG_NOTICE, LD_GENERAL, "Tor v%s. This is experimental software. "
"Do not rely on it for strong anonymity. (Running on %s)",get_version(),
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits