X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Flogger.cpp;h=049b4b5e7aa0883ca48fa77af7f4f3afdba443b1;hb=810c662c9b55908101ca085293c52c3239ef22d1;hp=10b5591e71f7149527321ab6a91047f77f0235e9;hpb=c6b11d2130c640bc4a68522aa3b6d48c49fa5d7b;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/logger.cpp b/src/logger.cpp index 10b5591e7..049b4b5e7 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -341,13 +341,15 @@ void FileWriter::HandleEvent(EventType ev, int) void FileWriter::WriteLogLine(const std::string &line) { - if (log) + if (log == NULL) + return; +// XXX: For now, just return. Don't throw an exception. It'd be nice to find out if this is happening, but I'm terrified of breaking so close to final release. -- w00t +// throw CoreException("FileWriter::WriteLogLine called with a closed logfile"); + + fprintf(log,"%s",line.c_str()); + if (writeops++ % 20) { - fprintf(log,"%s",line.c_str()); - if (writeops++ % 20) - { - fflush(log); - } + fflush(log); } } @@ -357,9 +359,11 @@ void FileWriter::Close() { fflush(log); fclose(log); + log = NULL; } } FileWriter::~FileWriter() { + this->Close(); }