Core/Logging: Removed one layer of allocations from log message writes (async doesn't wrap in shared_ptr anymore and sync creates LogMessage on the stack)

This commit is contained in:
Shauren
2024-07-10 14:51:29 +02:00
parent e05d194da3
commit 1cd7898c01
5 changed files with 39 additions and 36 deletions

View File

@@ -16,19 +16,16 @@
*/
#include "LogOperation.h"
#include "Logger.h"
#include "LogMessage.h"
#include "Logger.h"
LogOperation::LogOperation(Logger const* _logger, std::unique_ptr<LogMessage>&& _msg) : logger(_logger), msg(std::forward<std::unique_ptr<LogMessage>>(_msg))
LogOperation::LogOperation(Logger const* _logger, LogMessage* _msg) : logger(_logger), msg(_msg)
{
}
LogOperation::~LogOperation()
{
}
LogOperation::~LogOperation() = default;
int LogOperation::call()
void LogOperation::operator()() const
{
logger->write(msg.get());
return 0;
}