[*] only pump this on dtor

This commit is contained in:
Reece Wilson 2022-02-21 21:19:12 +00:00
parent 01254d088b
commit bb6025ab5f

View File

@ -216,26 +216,31 @@ namespace Aurora::Logging
}
}
static void ForceFlushLogger(Logger *logger)
{
for (const auto &sink : logger->sinks)
{
if (!sink)
{
continue;
}
try
{
sink->OnFlush();
}
catch (...)
{
SysPushErrorCatch();
}
}
}
void ForceFlushFlushNoLock()
{
for (const auto &logger : gFlushableLoggers)
{
for (const auto &sink : logger->sinks)
{
if (!sink)
{
continue;
}
try
{
sink->OnFlush();
}
catch (...)
{
SysPushErrorCatch();
}
}
ForceFlushLogger(logger);
}
}
@ -251,7 +256,7 @@ namespace Aurora::Logging
AU_LOCK_GUARD(gGlobalSpin);
ForceFlushLoggersNoLock();
ForceFlushFlushNoLock();
ForceFlushLogger(this);
{
AU_LOCK_GUARD(spin);