TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LogMessage Struct Reference

#include <Appender.h>

Public Member Functions

 LogMessage (LogLevel _level, std::string const &_type, std::string &&_text)
 
 LogMessage (LogMessage const &)=delete
 
LogMessageoperator= (LogMessage const &)=delete
 
std::string getTimeStr ()
 
uint32 Size () const
 @ Returns size of the log message content in bytes More...
 

Static Public Member Functions

static std::string getTimeStr (time_t time)
 

Public Attributes

LogLevel const level
 
std::string const type
 
std::string const text
 
std::string prefix
 
std::string param1
 
time_t mtime
 

Constructor & Destructor Documentation

LogMessage::LogMessage ( LogLevel  _level,
std::string const _type,
std::string &&  _text 
)
inline
65  : level(_level), type(_type), text(std::forward<std::string>(_text)), mtime(time(NULL))
66  { }
std::string const type
Definition: Appender.h:75
LogLevel const level
Definition: Appender.h:74
std::string const text
Definition: Appender.h:76
arena_t NULL
Definition: jemalloc_internal.h:624
time_t mtime
Definition: Appender.h:79
LogMessage::LogMessage ( LogMessage const )
delete

Member Function Documentation

std::string LogMessage::getTimeStr ( time_t  time)
static
27 {
28  tm aTm;
29  localtime_r(&time, &aTm);
30  char buf[20];
31  snprintf(buf, 20, "%04d-%02d-%02d_%02d:%02d:%02d", aTm.tm_year+1900, aTm.tm_mon+1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec);
32  return std::string(buf);
33 }
#define snprintf
Definition: Common.h:76
TC_COMMON_API struct tm * localtime_r(const time_t *time, struct tm *result)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::string LogMessage::getTimeStr ( )
36 {
37  return getTimeStr(mtime);
38 }
std::string getTimeStr()
Definition: Appender.cpp:35
time_t mtime
Definition: Appender.h:79

+ Here is the caller graph for this function:

LogMessage& LogMessage::operator= ( LogMessage const )
delete
uint32 LogMessage::Size ( ) const
inline

@ Returns size of the log message content in bytes

83  {
84  return static_cast<uint32>(prefix.size() + text.size());
85  }
std::string prefix
Definition: Appender.h:77
std::string const text
Definition: Appender.h:76
uint32_t uint32
Definition: Define.h:150

+ Here is the caller graph for this function:

Member Data Documentation

LogLevel const LogMessage::level
time_t LogMessage::mtime
std::string LogMessage::param1
std::string LogMessage::prefix
std::string const LogMessage::text
std::string const LogMessage::type

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