TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Logger Class Reference

#include <Logger.h>

Public Member Functions

 Logger ()
 
void Create (std::string const &name, LogLevel level)
 
void addAppender (uint8 type, Appender *)
 
void delAppender (uint8 type)
 
std::string constgetName () const
 
LogLevel getLogLevel () const
 
void setLogLevel (LogLevel level)
 
void write (LogMessage *message) const
 

Private Attributes

std::string name
 
LogLevel level
 
AppenderMap appenders
 

Constructor & Destructor Documentation

Logger::Logger ( )
20 : name(""), level(LOG_LEVEL_DISABLED) { }
std::string name
Definition: Logger.h:38
Definition: Appender.h:33
LogLevel level
Definition: Logger.h:39

Member Function Documentation

void Logger::addAppender ( uint8  type,
Appender appender 
)
39 {
40  appenders[id] = appender;
41 }
AppenderMap appenders
Definition: Logger.h:40

+ Here is the caller graph for this function:

void Logger::Create ( std::string const name,
LogLevel  level 
)
23 {
24  name = _name;
25  level = _level;
26 }
std::string name
Definition: Logger.h:38
LogLevel level
Definition: Logger.h:39

+ Here is the caller graph for this function:

void Logger::delAppender ( uint8  type)
44 {
45  appenders.erase(id);
46 }
AppenderMap appenders
Definition: Logger.h:40
LogLevel Logger::getLogLevel ( ) const
34 {
35  return level;
36 }
LogLevel level
Definition: Logger.h:39

+ Here is the caller graph for this function:

std::string const & Logger::getName ( ) const
29 {
30  return name;
31 }
std::string name
Definition: Logger.h:38

+ Here is the caller graph for this function:

void Logger::setLogLevel ( LogLevel  level)
49 {
50  level = _level;
51 }
LogLevel level
Definition: Logger.h:39
void Logger::write ( LogMessage message) const
54 {
55  if (!level || level > message->level || message->text.empty())
56  {
57  //fprintf(stderr, "Logger::write: Logger %s, Level %u. Msg %s Level %u WRONG LEVEL MASK OR EMPTY MSG\n", getName().c_str(), getLogLevel(), message.text.c_str(), message.level);
58  return;
59  }
60 
61  for (AppenderMap::const_iterator it = appenders.begin(); it != appenders.end(); ++it)
62  if (it->second)
63  it->second->write(message);
64 }
LogLevel const level
Definition: Appender.h:74
std::string const text
Definition: Appender.h:76
AppenderMap appenders
Definition: Logger.h:40
LogLevel level
Definition: Logger.h:39

+ Here is the caller graph for this function:

Member Data Documentation

AppenderMap Logger::appenders
private
LogLevel Logger::level
private
std::string Logger::name
private

The documentation for this class was generated from the following files: