summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/logger.cpp10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 5fe2ef076..0c9b67910 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -343,7 +343,7 @@ InspIRCd::InspIRCd(int argc, char** argv) :
if (do_debug)
{
- FileWriter* fw = new FileWriter(stdout);
+ FileWriter* fw = new FileWriter(stdout, 1);
FileLogStream* fls = new FileLogStream(LOG_RAWIO, fw);
Logs->AddLogTypes("*", fls, true);
}
diff --git a/src/logger.cpp b/src/logger.cpp
index 5b4a948ee..e3e956325 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -120,7 +120,7 @@ void LogManager::OpenFileLogs()
struct tm *mytime = gmtime(&time);
strftime(realtarget, sizeof(realtarget), target.c_str(), mytime);
FILE* f = fopen(realtarget, "a");
- fw = new FileWriter(f);
+ fw = new FileWriter(f, static_cast<unsigned int>(tag->getInt("flush", 20, 1, INT_MAX)));
logmap.insert(std::make_pair(target, fw));
}
else
@@ -309,8 +309,10 @@ void LogManager::Log(const std::string &type, LogLevel loglevel, const std::stri
}
-FileWriter::FileWriter(FILE* logfile)
-: log(logfile), writeops(0)
+FileWriter::FileWriter(FILE* logfile, unsigned int flushcount)
+ : log(logfile)
+ , flush(flushcount)
+ , writeops(0)
{
}
@@ -322,7 +324,7 @@ void FileWriter::WriteLogLine(const std::string &line)
// throw CoreException("FileWriter::WriteLogLine called with a closed logfile");
fputs(line.c_str(), log);
- if (++writeops % 20 == 0)
+ if (++writeops % flush == 0)
{
fflush(log);
}