refactor: Move ownership of Windows daemon file log outputter to Log

This commit is contained in:
Nick Bolton 2025-02-24 14:25:52 +00:00
parent 1c42552b3b
commit 890fd61e6e
5 changed files with 6 additions and 5 deletions

View file

@ -50,6 +50,7 @@
"Olena", "Olena",
"outputdir", "outputdir",
"outputter", "outputter",
"outputters",
"pacman", "pacman",
"Petroules", "Petroules",
"Pixmap", "Pixmap",

View file

@ -128,7 +128,7 @@ Log::Log(bool singleton)
// other initalization // other initalization
m_maxPriority = g_defaultMaxPriority; m_maxPriority = g_defaultMaxPriority;
insert(new ConsoleLogOutputter); // NOSONAR -- Adopted by `Log` insert(new ConsoleLogOutputter); // NOSONAR - Adopted by `Log`
if (singleton) { if (singleton) {
s_log = this; s_log = this;

View file

@ -133,10 +133,10 @@ SystemLogger::SystemLogger(const char *title, bool blockConsole) : m_stop(NULL)
{ {
// redirect log messages // redirect log messages
if (blockConsole) { if (blockConsole) {
m_stop = new StopLogOutputter; // NOSONAR -- Adopted by `Log` m_stop = new StopLogOutputter; // NOSONAR - Adopted by `Log`
CLOG->insert(m_stop); CLOG->insert(m_stop);
} }
m_syslog = new SystemLogOutputter; // NOSONAR -- Adopted by `Log` m_syslog = new SystemLogOutputter; // NOSONAR - Adopted by `Log`
m_syslog->open(title); m_syslog->open(title);
CLOG->insert(m_syslog); CLOG->insert(m_syslog);
} }

View file

@ -132,7 +132,7 @@ int App::daemonMainLoop(int, const char **)
void App::setupFileLogging() void App::setupFileLogging()
{ {
if (argsBase().m_logFile != NULL) { if (argsBase().m_logFile != NULL) {
m_fileLog = new FileLogOutputter(argsBase().m_logFile); // NOSONAR -- Adopted by `Log` m_fileLog = new FileLogOutputter(argsBase().m_logFile); // NOSONAR - Adopted by `Log`
CLOG->insert(m_fileLog); CLOG->insert(m_fileLog);
LOG((CLOG_DEBUG1 "logging to file (%s) enabled", argsBase().m_logFile)); LOG((CLOG_DEBUG1 "logging to file (%s) enabled", argsBase().m_logFile));
} }

View file

@ -220,7 +220,7 @@ DaemonApp::InitResult DaemonApp::init(IEventQueue *events, int argc, char **argv
#if SYSAPI_WIN32 #if SYSAPI_WIN32
// Only use MS debug outputter when the process is daemonized, since stdout won't be accessible // Only use MS debug outputter when the process is daemonized, since stdout won't be accessible
// in that case, but is accessible when running in the foreground. // in that case, but is accessible when running in the foreground.
CLOG->insert(new MSWindowsDebugOutputter()); CLOG->insert(new MSWindowsDebugOutputter()); // NOSONAR - Adopted by `Log`
#endif #endif
} }