mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 08:33:47 +00:00
refactor(Core/Misc): string handling and use smart pointer for strand (#22351)
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "Timer.h"
|
||||
#include "Tokenize.h"
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
|
||||
Log::Log() : AppenderId(0), highestLogLevel(LOG_LEVEL_FATAL)
|
||||
{
|
||||
@@ -39,7 +40,6 @@ Log::Log() : AppenderId(0), highestLogLevel(LOG_LEVEL_FATAL)
|
||||
|
||||
Log::~Log()
|
||||
{
|
||||
delete _strand;
|
||||
Close();
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ void Log::Initialize(Acore::Asio::IoContext* ioContext)
|
||||
if (ioContext)
|
||||
{
|
||||
_ioContext = ioContext;
|
||||
_strand = new Acore::Asio::Strand(*ioContext);
|
||||
_strand = std::make_unique<Acore::Asio::Strand>(*ioContext);
|
||||
}
|
||||
|
||||
LoadFromConfig();
|
||||
@@ -377,8 +377,7 @@ void Log::Initialize(Acore::Asio::IoContext* ioContext)
|
||||
|
||||
void Log::SetSynchronous()
|
||||
{
|
||||
delete _strand;
|
||||
_strand = nullptr;
|
||||
_strand.reset();
|
||||
_ioContext = nullptr;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "StringFormat.h"
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
class Appender;
|
||||
class Logger;
|
||||
@@ -120,7 +121,7 @@ private:
|
||||
std::string m_logsTimestamp;
|
||||
|
||||
Acore::Asio::IoContext* _ioContext;
|
||||
Acore::Asio::Strand* _strand;
|
||||
std::unique_ptr<Acore::Asio::Strand> _strand;
|
||||
};
|
||||
|
||||
#define sLog Log::instance()
|
||||
|
||||
Reference in New Issue
Block a user