diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-03-05 22:31:39 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-03-05 22:31:39 +0000 |
commit | f56ba5f3d62cc6a50432466d7202733d909a1ca6 (patch) | |
tree | 9357d7b1860a492c10d435f6ab8c4208aa618e64 /src/tools | |
parent | d3589553bc7b091538ee93bd86867232b50b0f78 (diff) | |
download | tor-f56ba5f3d62cc6a50432466d7202733d909a1ca6.tar.gz tor-f56ba5f3d62cc6a50432466d7202733d909a1ca6.zip |
r18630@catbus: nickm | 2008-03-05 17:31:33 -0500
Implement domain-selection for logging. Source is documented; needs documentation in manpage (maybe). For now, see doxygen comment on parse_log_severity_config in log.c
svn:r13875
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/tor-gencert.c | 11 | ||||
-rw-r--r-- | src/tools/tor-resolve.c | 11 |
2 files changed, 16 insertions, 6 deletions
diff --git a/src/tools/tor-gencert.c b/src/tools/tor-gencert.c index c6ba8dba8f..2912668240 100644 --- a/src/tools/tor-gencert.c +++ b/src/tools/tor-gencert.c @@ -123,6 +123,7 @@ static int parse_commandline(int argc, char **argv) { int i; + log_severity_list_t *s; for (i = 1; i < argc; ++i) { if (!strcmp(argv[i], "--help") || !strcmp(argv[i], "-h")) { show_help(); @@ -188,11 +189,15 @@ parse_commandline(int argc, char **argv) } } + s = tor_malloc_zero(sizeof(log_severity_list_t)); + s->masks[SEVERITY_MASK_IDX(LOG_ERR)] = ~0u; + s->masks[SEVERITY_MASK_IDX(LOG_WARN)] = ~0u; if (verbose) { - add_stream_log(LOG_INFO, LOG_ERR, "<stderr>", stderr); - } else { - add_stream_log(LOG_NOTICE, LOG_ERR, "<stderr>", stderr); + s->masks[SEVERITY_MASK_IDX(LOG_NOTICE)] = ~0u; + s->masks[SEVERITY_MASK_IDX(LOG_INFO)] = ~0u; + s->masks[SEVERITY_MASK_IDX(LOG_DEBUG)] = ~0u; } + add_stream_log(s, "<stderr>", stderr); if (!identity_key_file) { identity_key_file = tor_strdup("./authority_identity_key"); diff --git a/src/tools/tor-resolve.c b/src/tools/tor-resolve.c index 4dee5e85ae..ab43719e62 100644 --- a/src/tools/tor-resolve.c +++ b/src/tools/tor-resolve.c @@ -280,6 +280,7 @@ main(int argc, char **argv) uint32_t result = 0; char *result_hostname = NULL; char buf[INET_NTOA_BUF_LEN]; + log_severity_list_t *s = tor_malloc_zero(sizeof(log_severity_list_t)); init_logging(); @@ -317,11 +318,15 @@ main(int argc, char **argv) usage(); } + s->masks[SEVERITY_MASK_IDX(LOG_ERR)] = ~0u; + s->masks[SEVERITY_MASK_IDX(LOG_WARN)] = ~0u; if (isVerbose) { - add_stream_log(LOG_DEBUG, LOG_ERR, "<stderr>", stderr); - } else { - add_stream_log(LOG_WARN, LOG_ERR, "<stderr>", stderr); + s->masks[SEVERITY_MASK_IDX(LOG_NOTICE)] = ~0u; + s->masks[SEVERITY_MASK_IDX(LOG_INFO)] = ~0u; + s->masks[SEVERITY_MASK_IDX(LOG_DEBUG)] = ~0u; } + add_stream_log(s, "<stderr>", stderr); + if (n_args == 1) { log_debug(LD_CONFIG, "defaulting to localhost:9050"); sockshost = 0x7f000001u; /* localhost */ |