diff options
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 d8197c5ed..760535bb4 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 + |