diff options
author | Nick Mathewson <nickm@torproject.org> | 2006-01-11 19:40:14 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2006-01-11 19:40:14 +0000 |
commit | 099b9ce2f9d28e36628f26b465fe52eec4fa59ac (patch) | |
tree | ef1f527e0a2a563def21237aae182ef4002bb9fe /src/common/log.c | |
parent | 856546925a0dacd77eb1576493e80e164ed854a1 (diff) | |
download | tor-099b9ce2f9d28e36628f26b465fe52eec4fa59ac.tar.gz tor-099b9ce2f9d28e36628f26b465fe52eec4fa59ac.zip |
Fix bug 230: add a rollback function to reverse all changes since the last mark_logs_temp(), and move log initialization into the two-phase part of option setting.
svn:r5803
Diffstat (limited to 'src/common/log.c')
-rw-r--r-- | src/common/log.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/common/log.c b/src/common/log.c index d8197c5ed8..760535bb44 100644 --- a/src/common/log.c +++ b/src/common/log.c @@ -438,6 +438,17 @@ close_temp_logs(void) } } +/** Make all currently temporary logs (set to be closed by close_temp_logs) + * live again, and close all non-temporary logs. */ +void +rollback_log_changes(void) +{ + logfile_t *lf; + for (lf = logfiles; lf; lf = lf->next) + lf->is_temporary = ! lf->is_temporary; + close_temp_logs(); +} + /** Configure all log handles to be closed by close_temp_logs */ void mark_logs_temp(void) @@ -590,3 +601,38 @@ suppress_libevent_log_msg(const char *msg) } #endif +#if 0 +static void +dump_log_info(logfile_t *lf) +{ + const char *tp; + + if (lf->filename) { + printf("=== log into \"%s\" (%s-%s) (%stemporary)\n", lf->filename, + sev_to_string(lf->min_loglevel), + sev_to_string(lf->max_loglevel), + lf->is_temporary?"":"not "); + } else if (lf->is_syslog) { + printf("=== syslog (%s-%s) (%stemporary)\n", + sev_to_string(lf->min_loglevel), + sev_to_string(lf->max_loglevel), + lf->is_temporary?"":"not "); + } else { + printf("=== log (%s-%s) (%stemporary)\n", + sev_to_string(lf->min_loglevel), + sev_to_string(lf->max_loglevel), + lf->is_temporary?"":"not "); + } +} + +void +describe_logs(void) +{ + logfile_t *lf; + printf("==== BEGIN LOGS ====\n"); + for (lf = logfiles; lf; lf = lf->next) + dump_log_info(lf); + printf("==== END LOGS ====\n"); +} +#endif + |