TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Appender Class Referenceabstract

#include <Appender.h>

Public Member Functions

 Appender (uint8 _id, std::string const &name, LogLevel level=LOG_LEVEL_DISABLED, AppenderFlags flags=APPENDER_FLAGS_NONE)
 
virtual ~Appender ()
 
uint8 getId () const
 
std::string constgetName () const
 
virtual AppenderType getType () const =0
 
LogLevel getLogLevel () const
 
AppenderFlags getFlags () const
 
void setLogLevel (LogLevel)
 
void write (LogMessage *message)
 
virtual void setRealmId (uint32)
 

Static Public Member Functions

static const char * getLogLevelString (LogLevel level)
 

Private Member Functions

virtual void _write (LogMessage const *)=0
 

Private Attributes

uint8 id
 
std::string name
 
LogLevel level
 
AppenderFlags flags
 

Constructor & Destructor Documentation

Appender::Appender ( uint8  _id,
std::string const name,
LogLevel  level = LOG_LEVEL_DISABLED,
AppenderFlags  flags = APPENDER_FLAGS_NONE 
)
40  :
41 id(_id), name(_name), level(_level), flags(_flags) { }
uint8 id
Definition: Appender.h:108
std::string name
Definition: Appender.h:109
AppenderFlags flags
Definition: Appender.h:111
LogLevel level
Definition: Appender.h:110
Appender::~Appender ( )
virtual
43 { }

Member Function Documentation

virtual void Appender::_write ( LogMessage const )
privatepure virtual

Implemented in AppenderConsole, AppenderDB, and AppenderFile.

+ Here is the caller graph for this function:

AppenderFlags Appender::getFlags ( ) const
61 {
62  return flags;
63 }
AppenderFlags flags
Definition: Appender.h:111
uint8 Appender::getId ( ) const
46 {
47  return id;
48 }
uint8 id
Definition: Appender.h:108

+ Here is the caller graph for this function:

LogLevel Appender::getLogLevel ( ) const
56 {
57  return level;
58 }
LogLevel level
Definition: Appender.h:110
const char * Appender::getLogLevelString ( LogLevel  level)
static
91 {
92  switch (level)
93  {
94  case LOG_LEVEL_FATAL:
95  return "FATAL";
96  case LOG_LEVEL_ERROR:
97  return "ERROR";
98  case LOG_LEVEL_WARN:
99  return "WARN";
100  case LOG_LEVEL_INFO:
101  return "INFO";
102  case LOG_LEVEL_DEBUG:
103  return "DEBUG";
104  case LOG_LEVEL_TRACE:
105  return "TRACE";
106  default:
107  return "DISABLED";
108  }
109 }
Definition: Appender.h:35
Definition: Appender.h:34
Definition: Appender.h:36
Definition: Appender.h:37
Definition: Appender.h:38
Definition: Appender.h:39
LogLevel level
Definition: Appender.h:110

+ Here is the caller graph for this function:

std::string const & Appender::getName ( ) const
51 {
52  return name;
53 }
std::string name
Definition: Appender.h:109
virtual AppenderType Appender::getType ( ) const
pure virtual

Implemented in AppenderConsole, AppenderFile, and AppenderDB.

void Appender::setLogLevel ( LogLevel  _level)
66 {
67  level = _level;
68 }
LogLevel level
Definition: Appender.h:110

+ Here is the caller graph for this function:

virtual void Appender::setRealmId ( uint32  )
inlinevirtual

Reimplemented in AppenderDB.

103 { }
void Appender::write ( LogMessage message)
71 {
72  if (!level || level > message->level)
73  return;
74 
75  std::ostringstream ss;
76 
78  ss << message->getTimeStr() << ' ';
79 
82 
84  ss << '[' << message->type << "] ";
85 
86  message->prefix = ss.str();
87  _write(message);
88 }
static const char * getLogLevelString(LogLevel level)
Definition: Appender.cpp:90
std::string const type
Definition: Appender.h:75
std::string prefix
Definition: Appender.h:77
Definition: Appender.h:55
static std::string getTimeStr(time_t time)
Definition: Appender.cpp:26
LogLevel const level
Definition: Appender.h:74
virtual void _write(LogMessage const *)=0
Definition: Appender.h:57
Definition: Appender.h:56
std::string StringFormat(Format &&fmt, Args &&...args)
Default TC string format function.
Definition: StringFormat.h:28
AppenderFlags flags
Definition: Appender.h:111
LogLevel level
Definition: Appender.h:110

+ Here is the call graph for this function:

Member Data Documentation

AppenderFlags Appender::flags
private
uint8 Appender::id
private
LogLevel Appender::level
private
std::string Appender::name
private

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