summaryrefslogtreecommitdiff
path: root/src/or/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2004-05-19 20:07:08 +0000
committerNick Mathewson <nickm@torproject.org>2004-05-19 20:07:08 +0000
commit9d2cd7fc6e01ee5aafeaf222b5020c464a01a03d (patch)
tree6aed917dcc979673b9870fd29ed41b07e1b36f44 /src/or/main.c
parent1a829b0df4faf09546d9e4e9bbcc657405aee94a (diff)
downloadtor-9d2cd7fc6e01ee5aafeaf222b5020c464a01a03d.tar.gz
tor-9d2cd7fc6e01ee5aafeaf222b5020c464a01a03d.zip
Allow multiple logfiles at different severity ranges
svn:r1899
Diffstat (limited to 'src/or/main.c')
-rw-r--r--src/or/main.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/src/or/main.c b/src/or/main.c
index b5631eb753..996dea0c84 100644
--- a/src/or/main.c
+++ b/src/or/main.c
@@ -566,22 +566,7 @@ static int init_from_config(int argc, char **argv) {
}
/* Configure the log(s) */
- if(!options.LogFile && !options.RunAsDaemon)
- add_stream_log(options.loglevel, "<stdout>", stdout);
- if(options.LogFile) {
- if (add_file_log(options.loglevel, options.LogFile) != 0) {
- /* opening the log file failed! Use stderr and log a warning */
- add_stream_log(options.loglevel, "<stderr>", stderr);
- log_fn(LOG_WARN, "Cannot write to LogFile '%s': %s.", options.LogFile, strerror(errno));
- }
- log_fn(LOG_NOTICE, "Successfully opened LogFile '%s', redirecting output.",
- options.LogFile);
- }
- if(options.DebugLogFile) {
- if (add_file_log(LOG_DEBUG, options.DebugLogFile) != 0)
- log_fn(LOG_WARN, "Cannot write to DebugLogFile '%s': %s.", options.DebugLogFile, strerror(errno));
- log_fn(LOG_DEBUG, "Successfully opened DebugLogFile '%s'.", options.DebugLogFile);
- }
+ config_init_logs(&options);
/* Set up our buckets */
connection_bucket_init();
@@ -696,7 +681,7 @@ static int do_main_loop(void) {
#ifndef MS_WINDOWS /* do signal stuff only on unix */
if(please_dumpstats) {
/* prefer to log it at INFO, but make sure we always see it */
- dumpstats(options.loglevel>LOG_INFO ? options.loglevel : LOG_INFO);
+ dumpstats(get_min_log_level()>LOG_INFO ? get_min_log_level() : LOG_INFO);
please_dumpstats = 0;
}
if(please_reset) {
@@ -867,7 +852,7 @@ void exit_function(void)
int tor_main(int argc, char *argv[]) {
/* give it somewhere to log to initially */
- add_stream_log(LOG_INFO, "<stdout>", stdout);
+ add_stream_log(LOG_INFO, LOG_ERR, "<stdout>", stdout);
log_fn(LOG_NOTICE,"Tor v%s. This is experimental software. Do not use it if you need anonymity.",VERSION);
if (network_init()<0) {