fix core output when using neither syslog nor logfile
authorDaniel Albers <daniel@lbe.rs>
Sun, 5 Feb 2012 22:11:30 +0000 (23:11 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 6 Feb 2012 11:40:51 +0000 (12:40 +0100)
src/common/logger.cpp

index 78a3610..bf270f9 100644 (file)
@@ -76,22 +76,21 @@ void Logger::log() {
     }
     syslog(LOG_USER & prio, "%s", qPrintable(_buffer));
   }
     }
     syslog(LOG_USER & prio, "%s", qPrintable(_buffer));
   }
-  // don't log to stdout if --syslog was specified (but neither ignore --logfile)
-  if(!Quassel::logFile())
-    return;
 #endif
 
 #endif
 
-  _buffer.prepend(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss "));
+  // if we neither use syslog nor have a logfile we log to stdout
 
 
-  // if we don't have a logfile we log to stdout
+  if(Quassel::logFile() || !Quassel::logToSyslog()) {
+    _buffer.prepend(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss "));
 
 
-  QTextStream out(stdout);
-  if(Quassel::logFile() && Quassel::logFile()->isOpen()) {
-    _buffer.remove(QChar('\n'));
-    out.setDevice(Quassel::logFile());
-  }
+    QTextStream out(stdout);
+    if(Quassel::logFile() && Quassel::logFile()->isOpen()) {
+      _buffer.remove(QChar('\n'));
+      out.setDevice(Quassel::logFile());
+    }
 
 
-  out << _buffer << endl;
+    out << _buffer << endl;
+  }
 }
 
 
 }