mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 05:33:47 +01:00
Replace add_temp_log() with add_default_log().
We used to have this function so that we could mark our initial log-to-stdout as specifically temporary so that we would delete it once regular logs were configured. But it's no longer necessary to mark these logs as temporary, since we now use a mark-and-sweep process to ensure that _all_ not-configured logs are closed when we change our configuration. Instead, this function will be the basis of a refactoring in how we handle default logs.
This commit is contained in:
parent
800b823c29
commit
3a73f6612a
@ -564,11 +564,11 @@ tor_init(int argc, char *argv[])
|
||||
break;
|
||||
case QUIET_HUSH:
|
||||
/* --hush: log at warning or higher. */
|
||||
add_temp_log(LOG_WARN);
|
||||
add_default_log(LOG_WARN);
|
||||
break;
|
||||
case QUIET_NONE: /* fall through */
|
||||
default:
|
||||
add_temp_log(LOG_NOTICE);
|
||||
add_default_log(LOG_NOTICE);
|
||||
}
|
||||
quiet_level = quiet;
|
||||
|
||||
|
@ -995,18 +995,16 @@ logs_set_domain_logging(int enabled)
|
||||
UNLOCK_LOGS();
|
||||
}
|
||||
|
||||
/** Add a log handler to receive messages during startup (before the real
|
||||
* logs are initialized).
|
||||
/** Add a log handler to accept messages when no other log is configured.
|
||||
*/
|
||||
void
|
||||
add_temp_log(int min_severity)
|
||||
add_default_log(int min_severity)
|
||||
{
|
||||
log_severity_list_t *s = tor_malloc_zero(sizeof(log_severity_list_t));
|
||||
set_log_severity_config(min_severity, LOG_ERR, s);
|
||||
LOCK_LOGS();
|
||||
add_stream_log_impl(s, "<temp>", fileno(stdout));
|
||||
add_stream_log_impl(s, "<default>", fileno(stdout));
|
||||
tor_free(s);
|
||||
logfiles->is_temporary = 1;
|
||||
UNLOCK_LOGS();
|
||||
}
|
||||
|
||||
@ -1149,8 +1147,7 @@ flush_log_messages_from_startup(void)
|
||||
UNLOCK_LOGS();
|
||||
}
|
||||
|
||||
/** Close any log handlers added by add_temp_log() or marked by
|
||||
* mark_logs_temp(). */
|
||||
/** Close any log handlers marked by mark_logs_temp(). */
|
||||
void
|
||||
close_temp_logs(void)
|
||||
{
|
||||
|
@ -185,7 +185,7 @@ int get_min_log_level(void);
|
||||
void switch_logs_debug(void);
|
||||
void logs_free_all(void);
|
||||
void logs_close_sigsafe(void);
|
||||
void add_temp_log(int min_severity);
|
||||
void add_default_log(int min_severity);
|
||||
void close_temp_logs(void);
|
||||
void rollback_log_changes(void);
|
||||
void mark_logs_temp(void);
|
||||
|
Loading…
Reference in New Issue
Block a user