From 2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3 Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Thu, 25 Feb 2010 14:50:23 +0100 Subject: Use recursive mkdir for config directories, fix log initialization Logger now logs to stdout by default, and allows logging without having a log file open. This allows using logger for error logging in early startup functions. Reviewed-by: Jared Adams --- src/log.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'src/log.cpp') diff --git a/src/log.cpp b/src/log.cpp index 432d1b04..ba1610fd 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -35,7 +35,7 @@ #include Logger::Logger(): - mLogToStandardOut(false), + mLogToStandardOut(true), mChatWindow(NULL) { } @@ -61,11 +61,6 @@ void Logger::setLogFile(const std::string &logFilename) void Logger::log(const char *log_text, ...) { - if (!mLogFile.is_open()) - { - return; - } - char* buf = new char[1024]; va_list ap; @@ -94,7 +89,10 @@ void Logger::log(const char *log_text, ...) << (int)((tv.tv_usec / 10000) % 100) << "] "; - mLogFile << timeStr.str() << buf << std::endl; + if (mLogFile.is_open()) + { + mLogFile << timeStr.str() << buf << std::endl; + } if (mLogToStandardOut) { -- cgit v1.2.3-70-g09d2