1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Fixes excessive logging causing RMG slowdown

- Do not apply formatting on log entries that will be discarded due to
high log level
- Do not log incorrect access to visitablePos due to its numerous use by
RMG
This commit is contained in:
Ivan Savenko
2024-12-23 21:24:00 +00:00
parent 2272707175
commit 6da58a6871
4 changed files with 28 additions and 21 deletions

View File

@ -146,13 +146,16 @@ void CLogger::log(ELogLevel::ELogLevel level, const std::string & message) const
void CLogger::log(ELogLevel::ELogLevel level, const boost::format & fmt) const
{
try
if (getEffectiveLevel() <= level)
{
log(level, fmt.str());
}
catch(...)
{
log(ELogLevel::ERROR, "Invalid log format!");
try
{
log(level, fmt.str());
}
catch (...)
{
log(ELogLevel::ERROR, "Invalid log format!");
}
}
}