![]() |
TrinityCore
|
#include <Log.h>
Public Member Functions | |
| Log (Log const &)=delete | |
| Log (Log &&)=delete | |
| Log & | operator= (Log const &)=delete |
| Log & | operator= (Log &&)=delete |
| void | Initialize (Trinity::Asio::IoContext *ioContext) |
| void | SetAsynchronous (Trinity::Asio::IoContext *ioContext) |
| void | SetSynchronous () |
| void | LoadFromConfig () |
| void | Close () |
| bool | ShouldLog (std::string_view type, LogLevel level) const noexcept |
| Logger const * | GetEnabledLogger (std::string_view type, LogLevel level) const noexcept |
| bool | SetLogLevel (std::string const &name, int32 level, bool isLogger=true) |
| template<typename... Args> | |
| void | OutMessage (std::string_view filter, LogLevel level, Trinity::FormatString< Args... > fmt, Args &&... args) noexcept |
| template<typename... Args> | |
| void | OutMessageTo (Logger const *logger, std::string_view filter, LogLevel level, Trinity::FormatString< Args... > fmt, Args &&... args) noexcept |
| template<typename... Args> | |
| void | OutCommand (uint32 account, Trinity::FormatString< Args... > fmt, Args &&... args) noexcept |
| void | OutCharDump (std::string const &str, uint32 account_id, uint64 guid, std::string const &name) const noexcept |
| void | SetRealmId (uint32 id) |
| template<class AppenderImpl > | |
| void | RegisterAppender () |
| std::string const & | GetLogsDir () const |
| std::string const & | GetLogsTimestamp () const |
| void | CreateAppenderFromConfigLine (std::string const &name, std::string const &options) |
| void | CreateLoggerFromConfigLine (std::string const &name, std::string const &options) |
Static Public Member Functions | |
| static Log * | instance () noexcept |
| template<typename StringOrStringView > | |
| static constexpr std::string_view | make_string_view (StringOrStringView const &stringOrStringView) |
| template<size_t CharArraySize> | |
| static consteval std::string_view | make_string_view (char const(&chars)[CharArraySize]) |
| template<size_t CharArraySize> | |
| static consteval Trinity::FormatStringView | make_format_string_view (char const(&chars)[CharArraySize]) |
Private Member Functions | |
| Log () | |
| ~Log () | |
| Logger const * | GetLoggerByType (std::string_view 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 (Logger const *logger, std::string_view filter, LogLevel level, Trinity::FormatStringView messageFormat, Trinity::FormatArgs messageFormatArgs) const noexcept |
| void | OutCommandImpl (uint32 account, Trinity::FormatStringView messageFormat, Trinity::FormatArgs messageFormatArgs) const noexcept |
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_view, 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 |
|
delete |
|
delete |
| void Log::Close | ( | ) |
Definition at line 324 of file Log.cpp.
References appenders, and loggers.
Referenced by LoadFromConfig(), ReadLoggersFromConfig(), and ~Log().
|
private |
Definition at line 115 of file Log.cpp.
References CreateAppenderFromConfigLine(), and sConfigMgr.
Referenced by ReadAppendersFromConfig().
| void Log::CreateAppenderFromConfigLine | ( | std::string const & | name, |
| std::string const & | options | ||
| ) |
Definition at line 56 of file Log.cpp.
References APPENDER_FLAGS_NONE, APPENDER_INVALID, appenderFactory, appenders, flags, Appender::getId(), LOG_LEVEL_INVALID, NextAppenderId(), NUM_ENABLED_LOG_LEVELS, STRING_VIEW_FMT, STRING_VIEW_FMT_ARG, and Trinity::Tokenize().
Referenced by CreateAppenderFromConfig(), and SetupLogging().
|
private |
Definition at line 175 of file Log.cpp.
References CreateLoggerFromConfigLine(), and sConfigMgr.
Referenced by ReadLoggersFromConfig().
| void Log::CreateLoggerFromConfigLine | ( | std::string const & | name, |
| std::string const & | options | ||
| ) |
Definition at line 120 of file Log.cpp.
References Logger::addAppender(), GetAppenderByName(), Logger::getName(), LOG_LEVEL_DISABLED, LOG_LEVEL_INVALID, loggers, lowestLogLevel, NUM_ENABLED_LOG_LEVELS, STRING_VIEW_FMT, STRING_VIEW_FMT_ARG, and Trinity::Tokenize().
Referenced by CreateLoggerFromConfig(), and SetupLogging().
|
private |
Definition at line 47 of file Log.cpp.
References appenders.
Referenced by CreateLoggerFromConfigLine(), and SetLogLevel().
Definition at line 348 of file Log.cpp.
References Logger::getLogLevel(), and LOG_LEVEL_DISABLED.
Referenced by Player::outDebugValues().
|
private |
Definition at line 244 of file Log.cpp.
References GetLoggerByType(), LOGGER_ROOT, and loggers.
Referenced by GetLoggerByType().
|
staticprivate |
Definition at line 261 of file Log.cpp.
References TimeToTimestampStr().
| void Log::Initialize | ( | Trinity::Asio::IoContext * | ioContext | ) |
Definition at line 368 of file Log.cpp.
References LoadFromConfig(), and SetAsynchronous().
|
staticnoexcept |
| void Log::LoadFromConfig | ( | ) |
Definition at line 390 of file Log.cpp.
References AppenderId, Close(), LOG_LEVEL_FATAL, lowestLogLevel, m_logsDir, ReadAppendersFromConfig(), ReadLoggersFromConfig(), and sConfigMgr.
Referenced by Initialize().
|
inlinestatic |
|
inlinestatic |
|
inlinestaticconstexpr |
|
private |
Definition at line 42 of file Log.cpp.
References AppenderId.
Referenced by CreateAppenderFromConfigLine(), and ReadLoggersFromConfig().
|
noexcept |
Definition at line 299 of file Log.cpp.
References LOG_LEVEL_INFO, Trinity::Asio::post(), Trinity::StringFormat(), and Logger::write().
|
inlinenoexcept |
Definition at line 87 of file Log.h.
References LOG_LEVEL_INFO, and Trinity::MakeFormatArgs().
|
privatenoexcept |
Definition at line 231 of file Log.cpp.
References LOG_LEVEL_INFO, Trinity::Asio::post(), Trinity::ToString(), and Logger::write().
|
inlinenoexcept |
Definition at line 75 of file Log.h.
References Trinity::MakeFormatArgs().
|
privatenoexcept |
Definition at line 220 of file Log.cpp.
References Trinity::Asio::post().
|
inlinenoexcept |
Definition at line 81 of file Log.h.
References Trinity::MakeFormatArgs().
Referenced by Player::outDebugValues().
|
private |
Definition at line 180 of file Log.cpp.
References CreateAppenderFromConfig(), and sConfigMgr.
Referenced by LoadFromConfig().
|
private |
Definition at line 187 of file Log.cpp.
References Logger::addAppender(), APPENDER_FLAGS_NONE, appenders, Close(), CreateLoggerFromConfig(), Appender::getId(), Logger::getName(), LOG_LEVEL_DEBUG, LOG_LEVEL_ERROR, LOG_LEVEL_INFO, LOGGER_ROOT, loggers, NextAppenderId(), and sConfigMgr.
Referenced by LoadFromConfig().
|
inline |
|
private |
Definition at line 214 of file Log.cpp.
References appenderFactory, and ASSERT.
| void Log::SetAsynchronous | ( | Trinity::Asio::IoContext * | ioContext | ) |
Definition at line 374 of file Log.cpp.
References _ioContext, and _strand.
Referenced by Initialize(), and SetupLogging().
| bool Log::SetLogLevel | ( | std::string const & | name, |
| int32 | level, | ||
| bool | isLogger = true |
||
| ) |
Definition at line 266 of file Log.cpp.
References GetAppenderByName(), LOG_LEVEL_DISABLED, loggers, lowestLogLevel, and Appender::setLogLevel().
| void Log::SetSynchronous | ( | ) |
Definition at line 383 of file Log.cpp.
References _ioContext, and _strand.
|
noexcept |
Definition at line 330 of file Log.cpp.
References Logger::getLogLevel(), and LOG_LEVEL_DISABLED.
|
private |
Definition at line 152 of file Log.h.
Referenced by SetAsynchronous(), and SetSynchronous().
|
private |
Definition at line 153 of file Log.h.
Referenced by SetAsynchronous(), SetSynchronous(), and ~Log().
|
private |
Definition at line 143 of file Log.h.
Referenced by CreateAppenderFromConfigLine(), and RegisterAppender().
|
private |
Definition at line 146 of file Log.h.
Referenced by LoadFromConfig(), and NextAppenderId().
Definition at line 144 of file Log.h.
Referenced by Close(), CreateAppenderFromConfigLine(), GetAppenderByName(), ReadLoggersFromConfig(), and SetRealmId().
|
private |
Definition at line 145 of file Log.h.
Referenced by Close(), CreateLoggerFromConfigLine(), GetLoggerByType(), ReadLoggersFromConfig(), and SetLogLevel().
|
private |
Definition at line 147 of file Log.h.
Referenced by CreateLoggerFromConfigLine(), LoadFromConfig(), and SetLogLevel().
|
private |
Definition at line 149 of file Log.h.
Referenced by LoadFromConfig().