Core/Log: Allow configuring a maximum file size for a log file. If the file size is about to be exceeded, the core will create a new file titled <oldname>_.log and start outputting there.

This commit is contained in:
Machiavelli committed 2013-01-23 17:48:17 +01:00
1 parent 5e367c910a
commit 39c2d892f3
5 files changed
+43 -5

No files matched your search

+8 -1
View File
@@ -145,8 +145,15 @@ void Log::CreateAppenderFromConfig(const char* name)
filename += m_logsTimestamp;
}
uint64 maxFileSize = 0;
if (++iter != tokens.end())
{
char const* c = *iter;
maxFileSize = atoi(c);
}
uint8 id = NextAppenderId();
appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags);
appenders[id] = new AppenderFile(id, name, level, filename.c_str(), m_logsDir.c_str(), mode.c_str(), flags, maxFileSize);
//fprintf(stdout, "Log::CreateAppenderFromConfig: Created Appender %s (%u), Type FILE, Mask %u, File %s, Mode %s\n", name, id, level, filename.c_str(), mode.c_str()); // DEBUG - RemoveMe
break;
}