Core/Logging: Fixed log message order not being preserved when async logging was enabled and ThreadPool was greater than 1

Despite that issue, logging was still threadsafe, just not ordered properly
This commit is contained in:
Shauren
2023-08-25 10:40:47 +02:00
parent 30f57de184
commit b51afbdfb9
3 changed files with 7 additions and 3 deletions

View File

@@ -238,7 +238,7 @@ void Log::write(std::unique_ptr<LogMessage> msg) const
if (_ioContext)
{
std::shared_ptr<LogOperation> logOperation = std::make_shared<LogOperation>(logger, std::move(msg));
Trinity::Asio::post(*_ioContext, Trinity::Asio::bind_executor(*_strand, [logOperation]() { logOperation->call(); }));
Trinity::Asio::post(*_strand, [logOperation]() { logOperation->call(); });
}
else
logger->write(msg.get());