summaryrefslogtreecommitdiffstats
path: root/src/LoggerListeners.cpp
diff options
context:
space:
mode:
authorworktycho <work.tycho@gmail.com>2015-06-05 23:33:49 +0200
committerworktycho <work.tycho@gmail.com>2015-06-05 23:33:49 +0200
commit54c1926a3a79407a87fc0afe6963aeb26d149a7b (patch)
tree11aea958ecef35fcb5be5b107bcc504d59be5ae8 /src/LoggerListeners.cpp
parentMerge pull request #2206 from mc-server/APIDumpTimeStamp (diff)
parentDaemon support on Linux. (diff)
downloadcuberite-54c1926a3a79407a87fc0afe6963aeb26d149a7b.tar
cuberite-54c1926a3a79407a87fc0afe6963aeb26d149a7b.tar.gz
cuberite-54c1926a3a79407a87fc0afe6963aeb26d149a7b.tar.bz2
cuberite-54c1926a3a79407a87fc0afe6963aeb26d149a7b.tar.lz
cuberite-54c1926a3a79407a87fc0afe6963aeb26d149a7b.tar.xz
cuberite-54c1926a3a79407a87fc0afe6963aeb26d149a7b.tar.zst
cuberite-54c1926a3a79407a87fc0afe6963aeb26d149a7b.zip
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);