From 5e145c4c2de176b07406a1593db302d73816e31e Mon Sep 17 00:00:00 2001 From: Bob van Loosen Date: Thu, 21 Feb 2013 21:59:54 +0100 Subject: [PATCH] fixed: don't save logstrings when the log isn't opened yet, these tools don't really need logfiles --- src/util/log.cpp | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/src/util/log.cpp b/src/util/log.cpp index 53c26eb..d1f3930 100644 --- a/src/util/log.cpp +++ b/src/util/log.cpp @@ -46,7 +46,6 @@ static ofstream* g_logfile; static int g_logbuffsize; //size of the buffer static char* g_logbuff; //buffer for vsnprintf -static vector* g_logstrings; //we save any log lines here while the log isn't open //returns hour:minutes:seconds:microseconds string GetStrTime() @@ -185,27 +184,9 @@ void PrintLog (const char* fmt, const char* function, LogLevel loglevel, ...) if (nrspaces > 0) funcstr.insert(funcstr.length(), nrspaces, ' '); + //write the string to the logfile if (g_logfile && g_logfile->is_open() && g_printlogtofile) - { - //print any saved log lines - if (g_logstrings) - { - for (vector::iterator it = g_logstrings->begin(); it != g_logstrings->end(); it++) - *g_logfile << *it << flush; - - delete g_logstrings; - g_logstrings = NULL; - } - //write the string to the logfile *g_logfile << GetStrTime() << " " << funcstr << " " << logstr << '\n' << flush; - } - else if (g_printlogtofile) - { - //save the log line if the log isn't open yet - if (!g_logstrings) - g_logstrings = new vector; - g_logstrings->push_back(GetStrTime() + " " + funcstr + " " + logstr + '\n'); - } //print to stdout when requested if (g_logtostderr)