summaryrefslogtreecommitdiff
path: root/src/log.cpp
diff options
context:
space:
mode:
authorBernd Wachter <bwachter-tmw@lart.info>2010-02-25 14:50:23 +0100
committerBernd Wachter <bwachter-tmw@lart.info>2010-02-25 21:58:32 +0100
commit2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3 (patch)
tree50b9b47a6be0a2084097bca75d3eae9d6cc07bf9 /src/log.cpp
parent4df9004a4f4cfa1f1ec1e9a8ae6540710f32b0e2 (diff)
downloadmana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.tar.gz
mana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.tar.bz2
mana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.tar.xz
mana-2ebd55fdcd7e177be150f9c5bdd1cbff9b110ad3.zip
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
Diffstat (limited to 'src/log.cpp')
-rw-r--r--src/log.cpp12
1 files changed, 5 insertions, 7 deletions
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 <sys/time.h>
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)
{