commit 4d13c443f016d9a68e4af851454c69d312e57954 Author: Zack Weinberg zackw@panix.com Date: Tue Jul 26 15:46:36 2011 -0700
Diagnostic logs belong on stderr, not stdout --- src/test/unittest_dummy.c | 2 +- src/test/unittest_obfs2.c | 2 +- src/util.c | 6 +++--- src/util.h | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/test/unittest_dummy.c b/src/test/unittest_dummy.c index aaeafa9..6470528 100644 --- a/src/test/unittest_dummy.c +++ b/src/test/unittest_dummy.c @@ -58,7 +58,7 @@ test_dummy_option_parsing(void *unused) proto_params_free(c->result);
/* Unsuspend logging */ - log_set_method(LOG_METHOD_STDOUT, NULL); + log_set_method(LOG_METHOD_STDERR, NULL); }
/* All the tests below use this test environment: */ diff --git a/src/test/unittest_obfs2.c b/src/test/unittest_obfs2.c index 6767769..c6d793c 100644 --- a/src/test/unittest_obfs2.c +++ b/src/test/unittest_obfs2.c @@ -71,7 +71,7 @@ test_obfs2_option_parsing(void *unused) proto_params_free(c->result);
/* Unsuspend logging */ - log_set_method(LOG_METHOD_STDOUT, NULL); + log_set_method(LOG_METHOD_STDERR, NULL); }
/* All the tests below use this test environment: */ diff --git a/src/util.c b/src/util.c index 167e867..e44b131 100644 --- a/src/util.c +++ b/src/util.c @@ -298,7 +298,7 @@ ascii_strlower(char *s) #define LOG_SEV_DEBUG 1
/* logging method */ -static int logging_method=LOG_METHOD_STDOUT; +static int logging_method=LOG_METHOD_STDERR; /* minimum logging severity */ static int logging_min_sev=LOG_SEV_INFO; /* logfile fd */ @@ -473,8 +473,8 @@ logv(int severity, const char *format, va_list ap) buf[n]='\n'; buf[n+1]='\0';
- if (logging_method == LOG_METHOD_STDOUT) - fprintf(stdout, "%s", buf); + if (logging_method == LOG_METHOD_STDERR) + fprintf(stderr, "%s", buf); else if (logging_method == LOG_METHOD_FILE) { if (!logging_logfile) abort(); diff --git a/src/util.h b/src/util.h index ede23e4..4fc1a33 100644 --- a/src/util.h +++ b/src/util.h @@ -120,8 +120,8 @@ int obfs_snprintf(char *str, size_t size,
/** Log destinations */
-/** Spit log messages on stdout. */ -#define LOG_METHOD_STDOUT 1 +/** Spit log messages on stderr. */ +#define LOG_METHOD_STDERR 1 /** Place log messages in a file. */ #define LOG_METHOD_FILE 2 /** We don't want no logs. */