summaryrefslogtreecommitdiffstats
path: root/src/LoggerListeners.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/LoggerListeners.cpp')
-rw-r--r--src/LoggerListeners.cpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/LoggerListeners.cpp b/src/LoggerListeners.cpp
index 31b12af1e..132751e8e 100644
--- a/src/LoggerListeners.cpp
+++ b/src/LoggerListeners.cpp
@@ -238,8 +238,26 @@ public:
-cLogger::cListener * MakeConsoleListener(void)
+// Listener for when stdout is closed, i.e. When running as a daemon.
+class cNullConsoleListener
+ : public cLogger::cListener
+{
+ virtual void Log(AString a_Message, cLogger::eLogLevel a_LogLevel) override
+ {
+ }
+};
+
+
+
+
+
+cLogger::cListener * MakeConsoleListener(bool a_IsService)
{
+ if (a_IsService)
+ {
+ return new cNullConsoleListener;
+ }
+
#ifdef _WIN32
// See whether we are writing to a console the default console attrib:
bool ShouldColorOutput = (_isatty(_fileno(stdin)) != 0);