[*] 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() void ForceFlushFlushNoLock()
{ {
for (const auto &logger : gFlushableLoggers) for (const auto &logger : gFlushableLoggers)
{ {
for (const auto &sink : logger->sinks) ForceFlushLogger(logger);
{
if (!sink)
{
continue;
}
try
{
sink->OnFlush();
}
catch (...)
{
SysPushErrorCatch();
}
}
} }
} }
@ -251,7 +256,7 @@ namespace Aurora::Logging
AU_LOCK_GUARD(gGlobalSpin); AU_LOCK_GUARD(gGlobalSpin);
ForceFlushLoggersNoLock(); ForceFlushLoggersNoLock();
ForceFlushFlushNoLock(); ForceFlushLogger(this);
{ {
AU_LOCK_GUARD(spin); AU_LOCK_GUARD(spin);