![]() |
TrinityCore
|
#include <Log.h>
Public Member Functions | |
| void | Initialize (Trinity::Asio::IoContext *ioContext) |
| 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_view filter, LogLevel const level, Trinity::FormatString< Args... > fmt, Args &&... args) |
| template<typename... Args> | |
| void | OutCommand (uint32 account, Trinity::FormatString< Args... > fmt, Args &&... args) |
| void | OutCharDump (char const *str, uint32 account_id, uint64 guid, char const *name) |
| 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 | OutMessageImpl (std::string_view filter, LogLevel level, Trinity::FormatStringView messageFormat, Trinity::FormatArgs messageFormatArgs) |
| void | OutCommandImpl (uint32 account, Trinity::FormatStringView messageFormat, Trinity::FormatArgs messageFormatArgs) |
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 | lowestLogLevel |
| std::string | m_logsDir |
| std::string | m_logsTimestamp |
| Trinity::Asio::IoContext * | _ioContext |
| Trinity::Asio::Strand * | _strand |
|
private |
|
private |
Definition at line 33 of file Log.cpp.
References GetTimestampStr(), and m_logsTimestamp.
|
privatedelete |
|
privatedelete |
| void Log::Close | ( | ) |
Definition at line 331 of file Log.cpp.
References appenders, and loggers.
Referenced by LoadFromConfig(), ReadLoggersFromConfig(), and ~Log().
|
private |
Definition at line 60 of file Log.cpp.
References APPENDER_FLAGS_NONE, APPENDER_INVALID, appenderFactory, appenders, flags, Appender::getId(), LOG_LEVEL_INVALID, NextAppenderId(), NUM_ENABLED_LOG_LEVELS, sConfigMgr, and Trinity::Tokenize().
Referenced by ReadAppendersFromConfig().
|
private |
Definition at line 120 of file Log.cpp.
References GetAppenderByName(), LOG_LEVEL_DISABLED, LOG_LEVEL_INVALID, loggers, lowestLogLevel, NUM_ENABLED_LOG_LEVELS, sConfigMgr, and Trinity::Tokenize().
Referenced by ReadLoggersFromConfig().
|
private |
Definition at line 51 of file Log.cpp.
References appenders.
Referenced by CreateLoggerFromConfig(), and SetLogLevel().
|
private |
Definition at line 240 of file Log.cpp.
References GetLoggerByType(), LOGGER_ROOT, and loggers.
Referenced by GetLoggerByType(), ShouldLog(), and write().
|
staticprivate |
| void Log::Initialize | ( | Trinity::Asio::IoContext * | ioContext | ) |
Definition at line 361 of file Log.cpp.
References _ioContext, _strand, and LoadFromConfig().
|
static |
| void Log::LoadFromConfig | ( | ) |
Definition at line 379 of file Log.cpp.
References AppenderId, Close(), LOG_LEVEL_FATAL, lowestLogLevel, m_logsDir, ReadAppendersFromConfig(), ReadLoggersFromConfig(), and sConfigMgr.
Referenced by Initialize().
|
private |
Definition at line 46 of file Log.cpp.
References AppenderId.
Referenced by CreateAppenderFromConfig(), and ReadLoggersFromConfig().
Definition at line 307 of file Log.cpp.
References LOG_LEVEL_INFO, ShouldLog(), and write().
|
inline |
Definition at line 81 of file Log.h.
References LOG_LEVEL_INFO, and Trinity::MakeFormatArgs().
|
private |
Definition at line 222 of file Log.cpp.
References LOG_LEVEL_INFO, Trinity::StringVFormat(), Trinity::ToString(), and write().
|
inline |
Definition at line 75 of file Log.h.
References Trinity::MakeFormatArgs().
|
private |
Definition at line 217 of file Log.cpp.
References Trinity::StringVFormat(), and write().
|
private |
Definition at line 176 of file Log.cpp.
References CreateAppenderFromConfig(), and sConfigMgr.
Referenced by LoadFromConfig().
|
private |
Definition at line 183 of file Log.cpp.
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 |
|
private |
Definition at line 210 of file Log.cpp.
References appenderFactory, and ASSERT.
| bool Log::SetLogLevel | ( | std::string const & | name, |
| int32 | level, | ||
| bool | isLogger = true |
||
| ) |
Definition at line 274 of file Log.cpp.
References GetAppenderByName(), LOG_LEVEL_DISABLED, loggers, lowestLogLevel, and Appender::setLogLevel().
| void Log::SetSynchronous | ( | ) |
Definition at line 372 of file Log.cpp.
References _ioContext, and _strand.
| bool Log::ShouldLog | ( | std::string const & | type, |
| LogLevel | level | ||
| ) | const |
Definition at line 337 of file Log.cpp.
References GetLoggerByType(), Logger::getLogLevel(), LOG_LEVEL_DISABLED, and lowestLogLevel.
Referenced by OutCharDump().
|
private |
Definition at line 227 of file Log.cpp.
References _ioContext, _strand, GetLoggerByType(), Trinity::Asio::post(), and Logger::write().
Referenced by OutCharDump(), OutCommandImpl(), and OutMessageImpl().
|
private |
Definition at line 126 of file Log.h.
Referenced by Initialize(), SetSynchronous(), and write().
|
private |
Definition at line 127 of file Log.h.
Referenced by Initialize(), SetSynchronous(), write(), and ~Log().
|
private |
Definition at line 117 of file Log.h.
Referenced by CreateAppenderFromConfig(), and RegisterAppender().
|
private |
Definition at line 120 of file Log.h.
Referenced by LoadFromConfig(), and NextAppenderId().
Definition at line 118 of file Log.h.
Referenced by Close(), CreateAppenderFromConfig(), GetAppenderByName(), ReadLoggersFromConfig(), and SetRealmId().
|
private |
Definition at line 119 of file Log.h.
Referenced by Close(), CreateLoggerFromConfig(), GetLoggerByType(), ReadLoggersFromConfig(), and SetLogLevel().
|
private |
Definition at line 121 of file Log.h.
Referenced by CreateLoggerFromConfig(), LoadFromConfig(), SetLogLevel(), and ShouldLog().
|
private |
Definition at line 123 of file Log.h.
Referenced by LoadFromConfig().