core: Settle log target if we're going to be closing all fds

Whenever we're going to close all file descriptors, we tend to close
the log and set it into open when needed mode. When this is done with
the logging target set to LOG_TARGET_AUTO, we run into issues because
for every logging call, we'll check if stderr is connected to the
journal to determine where to send the logging message. This check
obviously stops working when we close stderr, so we settle the log
target before we do that so that we keep using the same logging
target even after stderr is closed.
This commit is contained in:
Daan De Meyer
2023-03-20 13:26:57 +01:00
parent 8d0747abb7
commit a3b00f91bb
7 changed files with 24 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ void log_set_target(LogTarget target);
void log_set_target_and_open(LogTarget target);
int log_set_target_from_string(const char *e);
LogTarget log_get_target(void) _pure_;
void log_settle_target(void);
void log_set_max_level(int level);
int log_set_max_level_from_string(const char *e);