From 890fd61e6ed697ba2e3b8f1d897dbc1e56870d41 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Mon, 24 Feb 2025 14:25:52 +0000 Subject: [PATCH] refactor: Move ownership of Windows daemon file log outputter to `Log` --- cspell.json | 1 + src/lib/base/Log.cpp | 2 +- src/lib/base/log_outputters.cpp | 4 ++-- src/lib/deskflow/App.cpp | 2 +- src/lib/deskflow/DaemonApp.cpp | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/cspell.json b/cspell.json index 78f85a22b..0d425778b 100644 --- a/cspell.json +++ b/cspell.json @@ -50,6 +50,7 @@ "Olena", "outputdir", "outputter", + "outputters", "pacman", "Petroules", "Pixmap", diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index cd3a43874..2aee07df1 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -128,7 +128,7 @@ Log::Log(bool singleton) // other initalization m_maxPriority = g_defaultMaxPriority; - insert(new ConsoleLogOutputter); // NOSONAR -- Adopted by `Log` + insert(new ConsoleLogOutputter); // NOSONAR - Adopted by `Log` if (singleton) { s_log = this; diff --git a/src/lib/base/log_outputters.cpp b/src/lib/base/log_outputters.cpp index e079dc38a..adfb48d8f 100644 --- a/src/lib/base/log_outputters.cpp +++ b/src/lib/base/log_outputters.cpp @@ -133,10 +133,10 @@ SystemLogger::SystemLogger(const char *title, bool blockConsole) : m_stop(NULL) { // redirect log messages if (blockConsole) { - m_stop = new StopLogOutputter; // NOSONAR -- Adopted by `Log` + m_stop = new StopLogOutputter; // NOSONAR - Adopted by `Log` CLOG->insert(m_stop); } - m_syslog = new SystemLogOutputter; // NOSONAR -- Adopted by `Log` + m_syslog = new SystemLogOutputter; // NOSONAR - Adopted by `Log` m_syslog->open(title); CLOG->insert(m_syslog); } diff --git a/src/lib/deskflow/App.cpp b/src/lib/deskflow/App.cpp index a7c314400..65d6727ee 100644 --- a/src/lib/deskflow/App.cpp +++ b/src/lib/deskflow/App.cpp @@ -132,7 +132,7 @@ int App::daemonMainLoop(int, const char **) void App::setupFileLogging() { 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); LOG((CLOG_DEBUG1 "logging to file (%s) enabled", argsBase().m_logFile)); } diff --git a/src/lib/deskflow/DaemonApp.cpp b/src/lib/deskflow/DaemonApp.cpp index d80d4c2f1..8b506177d 100644 --- a/src/lib/deskflow/DaemonApp.cpp +++ b/src/lib/deskflow/DaemonApp.cpp @@ -220,7 +220,7 @@ DaemonApp::InitResult DaemonApp::init(IEventQueue *events, int argc, char **argv #if SYSAPI_WIN32 // 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. - CLOG->insert(new MSWindowsDebugOutputter()); + CLOG->insert(new MSWindowsDebugOutputter()); // NOSONAR - Adopted by `Log` #endif }