AzerothCore 3.3.5a
OpenSource WoW Emulator
|
#include "Log.h"
Public Member Functions | |
void | Initialize (Acore::Asio::IoContext *ioContext=nullptr) |
void | SetSynchronous () |
void | LoadFromConfig () |
void | Close () |
bool | ShouldLog (std::string const &type, LogLevel level) const |
bool | SetLogLevel (std::string const &name, int32 level, bool isLogger=true) |
template<typename... Args> | |
void | outMessage (std::string const &filter, LogLevel const level, Acore::FormatString< Args... > fmt, Args &&... args) |
template<typename... Args> | |
void | outCommand (uint32 account, Acore::FormatString< Args... > fmt, Args &&... args) |
void | SetRealmId (uint32 id) |
template<class AppenderImpl > | |
void | RegisterAppender () |
std::string const & | GetLogsDir () const |
std::string const & | GetLogsTimestamp () const |
Static Public Member Functions | |
static Log * | instance () |
Private Types | |
typedef std::unordered_map< std::string, Logger > | LoggerMap |
Private Member Functions | |
Log () | |
~Log () | |
Log (Log const &)=delete | |
Log (Log &&)=delete | |
Log & | operator= (Log const &)=delete |
Log & | operator= (Log &&)=delete |
void | write (std::unique_ptr< LogMessage > &&msg) const |
Logger const * | GetLoggerByType (std::string const &type) const |
Appender * | GetAppenderByName (std::string_view name) |
uint8 | NextAppenderId () |
void | CreateAppenderFromConfig (std::string const &name) |
void | CreateLoggerFromConfig (std::string const &name) |
void | ReadAppendersFromConfig () |
void | ReadLoggersFromConfig () |
void | RegisterAppender (uint8 index, AppenderCreatorFn appenderCreateFn) |
void | _outMessage (std::string const &filter, LogLevel level, std::string_view message) |
void | _outCommand (std::string_view message, std::string_view param1) |
Static Private Member Functions | |
static std::string | GetTimestampStr () |
Private Attributes | |
std::unordered_map< uint8, AppenderCreatorFn > | appenderFactory |
std::unordered_map< uint8, std::unique_ptr< Appender > > | appenders |
std::unordered_map< std::string, std::unique_ptr< Logger > > | loggers |
uint8 | AppenderId |
LogLevel | highestLogLevel |
std::string | m_logsDir |
std::string | m_logsTimestamp |
Acore::Asio::IoContext * | _ioContext |
Acore::Asio::Strand * | _strand |
|
private |
|
private |
References GetTimestampStr(), and m_logsTimestamp.
|
private |
|
privatedelete |
|
privatedelete |
|
private |
|
private |
References write().
Referenced by outMessage().
void Log::Close | ( | ) |
References appenders, and loggers.
Referenced by LoadFromConfig(), ReadLoggersFromConfig(), and ~Log().
|
private |
References APPENDER_FLAGS_NONE, APPENDER_INVALID, appenderFactory, appenders, Appender::getId(), LOG_LEVEL_INVALID, NextAppenderId(), NUM_ENABLED_LOG_LEVELS, sConfigMgr, and Acore::Tokenize().
Referenced by ReadAppendersFromConfig().
|
private |
References GetAppenderByName(), highestLogLevel, LOG_LEVEL_DISABLED, LOG_LEVEL_INVALID, loggers, NUM_ENABLED_LOG_LEVELS, sConfigMgr, and Acore::Tokenize().
Referenced by ReadLoggersFromConfig().
|
private |
References appenders.
Referenced by CreateLoggerFromConfig(), and SetLogLevel().
|
private |
References GetLoggerByType(), LOGGER_ROOT, and loggers.
Referenced by GetLoggerByType(), ShouldLog(), and write().
|
inline |
References m_logsDir.
|
inline |
References m_logsTimestamp.
|
staticprivate |
References GetEpochTime(), and Acore::Time::TimeToTimestampStr().
Referenced by Log().
void Log::Initialize | ( | Acore::Asio::IoContext * | ioContext = nullptr | ) |
References _ioContext, _strand, and LoadFromConfig().
|
static |
void Log::LoadFromConfig | ( | ) |
References AppenderId, Close(), highestLogLevel, LOG_LEVEL_FATAL, m_logsDir, ReadAppendersFromConfig(), ReadLoggersFromConfig(), and sConfigMgr.
Referenced by Initialize().
|
private |
References AppenderId.
Referenced by CreateAppenderFromConfig(), and ReadLoggersFromConfig().
|
inline |
References _outCommand(), LOG_LEVEL_INFO, ShouldLog(), and Acore::StringFormat().
|
inline |
References _outMessage(), and Acore::StringFormat().
|
private |
References CreateAppenderFromConfig(), and sConfigMgr.
Referenced by LoadFromConfig().
|
private |
References Logger::addAppender(), APPENDER_FLAGS_NONE, appenders, Close(), CreateLoggerFromConfig(), Appender::getId(), LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOGGER_ROOT, loggers, NextAppenderId(), and sConfigMgr.
Referenced by LoadFromConfig().
|
inline |
References RegisterAppender().
Referenced by RegisterAppender().
|
private |
References appenderFactory, and ASSERT.
bool Log::SetLogLevel | ( | std::string const & | name, |
int32 | level, | ||
bool | isLogger = true |
||
) |
References GetAppenderByName(), highestLogLevel, LOG_LEVEL_DISABLED, loggers, and Appender::setLogLevel().
void Log::SetRealmId | ( | uint32 | id | ) |
void Log::SetSynchronous | ( | ) |
References _ioContext, and _strand.
bool Log::ShouldLog | ( | std::string const & | type, |
LogLevel | level | ||
) | const |
References GetLoggerByType(), Logger::getLogLevel(), highestLogLevel, and LOG_LEVEL_DISABLED.
Referenced by outCommand().
|
private |
References _ioContext, _strand, Acore::Asio::bind_executor(), GetLoggerByType(), Acore::Asio::post(), and Logger::write().
Referenced by _outCommand(), and _outMessage().
|
private |
Referenced by Initialize(), SetSynchronous(), and write().
|
private |
Referenced by Initialize(), SetSynchronous(), write(), and ~Log().
|
private |
Referenced by CreateAppenderFromConfig(), and RegisterAppender().
|
private |
Referenced by LoadFromConfig(), and NextAppenderId().
Referenced by Close(), CreateAppenderFromConfig(), GetAppenderByName(), ReadLoggersFromConfig(), and SetRealmId().
|
private |
Referenced by CreateLoggerFromConfig(), LoadFromConfig(), SetLogLevel(), and ShouldLog().
|
private |
Referenced by Close(), CreateLoggerFromConfig(), GetLoggerByType(), ReadLoggersFromConfig(), and SetLogLevel().
|
private |
Referenced by GetLogsDir(), and LoadFromConfig().
|
private |
Referenced by GetLogsTimestamp(), and Log().