diff --git a/cspell.json b/cspell.json index 5160873bb..0da257cae 100644 --- a/cspell.json +++ b/cspell.json @@ -11,9 +11,10 @@ "codesigning", "Compat", "contribs", + "daemonized", "Daun", - "Devs", "Deskflow", + "Devs", "distro", "distros", "dmgbuild", @@ -48,6 +49,7 @@ "Oleksandr", "Olena", "outputdir", + "outputter", "pacman", "Petroules", "Pixmap", diff --git a/src/lib/base/Log.cpp b/src/lib/base/Log.cpp index dc5829b95..cd3a43874 100644 --- a/src/lib/base/Log.cpp +++ b/src/lib/base/Log.cpp @@ -208,27 +208,18 @@ void Log::print(const char *file, int line, const char *fmt, ...) } } -void Log::insert(ILogOutputter *outputter, bool alwaysAtHead) +void Log::insert(ILogOutputter *adoptedOutputter, bool alwaysAtHead) { - assert(outputter != NULL); + assert(adoptedOutputter != NULL); ArchMutexLock lock(m_mutex); if (alwaysAtHead) { - m_alwaysOutputters.push_front(outputter); + m_alwaysOutputters.push_front(adoptedOutputter); } else { - m_outputters.push_front(outputter); + m_outputters.push_front(adoptedOutputter); } - outputter->open(kAppName); - - // Issue 41 - // don't show log unless user requests it, as some users find this - // feature irritating (i.e. when they lose network connectivity). - // in windows the log window can be displayed by selecting "show log" - // from the deskflow system tray icon. - // if this causes problems for other architectures, then a different - // work around should be attempted. - // outputter->show(false); + adoptedOutputter->open(kAppName); } void Log::remove(ILogOutputter *outputter) diff --git a/src/lib/base/Log.h b/src/lib/base/Log.h index 6c12ea9d8..78266b538 100644 --- a/src/lib/base/Log.h +++ b/src/lib/base/Log.h @@ -42,10 +42,12 @@ public: //! @name manipulators //@{ - //! Add an outputter to the head of the list + //! Add an outputter to the head of the list and adopts it. /*! - Inserts an outputter to the head of the outputter list. When the - logger writes a message, it goes to the outputter at the head of + Inserts an outputter to the head of the outputter list. The outputter + is deleted when Log destructor is called. + + When the logger writes a message, it goes to the outputter at the head of the outputter list. If that outputter's \c write() method returns true then it also goes to the next outputter, as so on until an outputter returns false or there are no more outputters. Outputters @@ -57,7 +59,7 @@ public: By default, the logger has one outputter installed which writes to the console. */ - void insert(ILogOutputter *adopted, bool alwaysAtHead = false); + void insert(ILogOutputter *adoptedOutputter, bool alwaysAtHead = false); //! Remove an outputter from the list /*!