log: make log_set_upgrade_syslog_to_journal() take effect immediately

This doesn't matter much, and we don't rely on it, but I think it's much
nicer if we log_set_target() and log_set_upgrade_syslog_to_journal() can
be called in either order and have the same effect.
This commit is contained in:
Lennart Poettering
2018-01-24 18:22:56 +01:00
parent ab93297cd0
commit 6fdb8de42f
3 changed files with 10 additions and 0 deletions
+8
View File
@@ -1314,6 +1314,14 @@ int log_syntax_invalid_utf8_internal(
void log_set_upgrade_syslog_to_journal(bool b) {
upgrade_syslog_to_journal = b;
/* Make the change effective immediately */
if (b) {
if (log_target == LOG_TARGET_SYSLOG)
log_target = LOG_TARGET_JOURNAL;
else if (log_target == LOG_TARGET_SYSLOG_OR_KMSG)
log_target = LOG_TARGET_JOURNAL_OR_KMSG;
}
}
void log_set_always_reopen_console(bool b) {
+1
View File
@@ -302,6 +302,7 @@ LogTarget log_target_from_string(const char *s) _pure_;
void log_received_signal(int level, const struct signalfd_siginfo *si);
/* If turned on, any requests for a log target involving "syslog" will be implicitly upgraded to the equivalent journal target */
void log_set_upgrade_syslog_to_journal(bool b);
void log_set_always_reopen_console(bool b);
void log_set_open_when_needed(bool b);