Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
Log Class Reference

#include <Log.h>

Collaboration diagram for Log:

Public Member Functions

void Close ()
void LoadFromConfig ()
void void void outCharDump (char const *str, uint32 account_id, uint32 guid, char const *name)
void void outCommand (uint32 account, const char *str,...) ATTR_PRINTF(3
void outMessage (std::string const &f, LogLevel level, char const *str,...) ATTR_PRINTF(4
bool SetLogLevel (std::string const &name, char const *level, bool isLogger=true)
void SetRealmId (uint32 id)
bool ShouldLog (std::string const &type, LogLevel level) const

Private Types

typedef UNORDERED_MAP< std::string, LoggerLoggerMap

Private Member Functions

void CreateAppenderFromConfig (std::string const &name)
void CreateLoggerFromConfig (std::string const &name)
AppenderGetAppenderByName (std::string const &name)
Logger const * GetLoggerByType (std::string const &type) const
 Log ()
uint8 NextAppenderId ()
void ReadAppendersFromConfig ()
void ReadLoggersFromConfig ()
void vlog (std::string const &f, LogLevel level, char const *str, va_list argptr)
void write (LogMessage *msg) const
 ~Log ()

Static Private Member Functions

static std::string GetTimestampStr ()

Private Attributes

uint8 AppenderId
AppenderMap appenders
LoggerMap loggers
std::string m_logsDir
std::string m_logsTimestamp
LogWorkerworker

Friends

class Skyfire::Singleton< Log, Skyfire::Mutex >

Detailed Description

Definition at line 21 of file Log.h.

Member Typedef Documentation

◆ LoggerMap

typedef UNORDERED_MAP<std::string, Logger> Log::LoggerMap
private

Definition at line 25 of file Log.h.

Constructor & Destructor Documentation

◆ Log()

Log::Log ( )
private

Definition at line 20 of file Log.cpp.

References GetTimestampStr(), LoadFromConfig(), m_logsTimestamp, and worker.

◆ ~Log()

Log::~Log ( )
private

Definition at line 26 of file Log.cpp.

References Close().

Member Function Documentation

◆ Close()

void Log::Close ( )

Definition at line 356 of file Log.cpp.

References appenders, loggers, and worker.

Referenced by LoadFromConfig(), ReadLoggersFromConfig(), and ~Log().

◆ CreateAppenderFromConfig()

◆ CreateLoggerFromConfig()

void Log::CreateLoggerFromConfig ( std::string const & name)
private

◆ GetAppenderByName()

Appender * Log::GetAppenderByName ( std::string const & name)
private

Definition at line 48 of file Log.cpp.

References appenders.

Referenced by CreateLoggerFromConfig(), and SetLogLevel().

◆ GetLoggerByType()

Logger const * Log::GetLoggerByType ( std::string const & type) const
inlineprivate

Definition at line 67 of file Log.h.

References GetLoggerByType(), LOGGER_ROOT, and loggers.

Referenced by GetLoggerByType(), ShouldLog(), and write().

◆ GetTimestampStr()

std::string Log::GetTimestampStr ( )
staticprivate

Definition at line 272 of file Log.cpp.

References Skyfire::LocalTime().

Referenced by Log().

◆ LoadFromConfig()

void Log::LoadFromConfig ( )

Definition at line 369 of file Log.cpp.

References AppenderId, Close(), m_logsDir, ReadAppendersFromConfig(), ReadLoggersFromConfig(), sConfigMgr, and worker.

Referenced by Log().

◆ NextAppenderId()

uint8 Log::NextAppenderId ( )
private

Definition at line 31 of file Log.cpp.

References AppenderId.

Referenced by CreateAppenderFromConfig(), and ReadLoggersFromConfig().

◆ outCharDump()

void Log::outCharDump ( char const * str,
uint32 account_id,
uint32 guid,
char const * name )

Definition at line 311 of file Log.cpp.

References LOG_LEVEL_INFO, LogMessage::param1, ShouldLog(), and write().

◆ outCommand()

void Log::outCommand ( uint32 account,
const char * str,
... )

Definition at line 329 of file Log.cpp.

References LOG_LEVEL_INFO, MAX_QUERY_LEN, LogMessage::param1, ShouldLog(), vsnprintf, and write().

◆ outMessage()

void Log::outMessage ( std::string const & f,
LogLevel level,
char const * str,
... )
inline

Definition at line 98 of file Log.h.

References vlog().

◆ ReadAppendersFromConfig()

void Log::ReadAppendersFromConfig ( )
private

Definition at line 209 of file Log.cpp.

References CreateAppenderFromConfig(), and sConfigMgr.

Referenced by LoadFromConfig().

◆ ReadLoggersFromConfig()

◆ SetLogLevel()

bool Log::SetLogLevel ( std::string const & name,
char const * level,
bool isLogger = true )

Definition at line 282 of file Log.cpp.

References GetAppenderByName(), LOG_LEVEL_DISABLED, loggers, and Appender::setLogLevel().

◆ SetRealmId()

void Log::SetRealmId ( uint32 id)

Definition at line 349 of file Log.cpp.

References APPENDER_DB, and appenders.

◆ ShouldLog()

bool Log::ShouldLog ( std::string const & type,
LogLevel level ) const
inline

Definition at line 84 of file Log.h.

References GetLoggerByType(), Logger::getLogLevel(), and LOG_LEVEL_DISABLED.

Referenced by outCharDump(), and outCommand().

◆ vlog()

void Log::vlog ( std::string const & f,
LogLevel level,
char const * str,
va_list argptr )
private

Definition at line 251 of file Log.cpp.

References MAX_QUERY_LEN, vsnprintf, and write().

Referenced by outMessage().

◆ write()

void Log::write ( LogMessage * msg) const
private

Definition at line 258 of file Log.cpp.

References GetLoggerByType(), LogMessage::text, LogMessage::type, worker, and Logger::write().

Referenced by outCharDump(), outCommand(), and vlog().

◆ Skyfire::Singleton< Log, Skyfire::Mutex >

friend class Skyfire::Singleton< Log, Skyfire::Mutex >
friend

Definition at line 98 of file Log.h.

Member Data Documentation

◆ AppenderId

uint8 Log::AppenderId
private

Definition at line 59 of file Log.h.

Referenced by LoadFromConfig(), and NextAppenderId().

◆ appenders

AppenderMap Log::appenders
private

◆ loggers

LoggerMap Log::loggers
private

◆ m_logsDir

std::string Log::m_logsDir
private

Definition at line 61 of file Log.h.

Referenced by CreateAppenderFromConfig(), and LoadFromConfig().

◆ m_logsTimestamp

std::string Log::m_logsTimestamp
private

Definition at line 62 of file Log.h.

Referenced by CreateAppenderFromConfig(), and Log().

◆ worker

LogWorker* Log::worker
private

Definition at line 64 of file Log.h.

Referenced by Close(), LoadFromConfig(), Log(), and write().


The documentation for this class was generated from the following files:
  • src/server/shared/Logging/Log.h
  • src/server/shared/Logging/Log.cpp