AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
LogMessage Struct Reference

#include "LogMessage.h"

Public Member Functions

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

Static Public Member Functions

static std::string getTimeStr (Seconds time)
 

Public Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ LogMessage() [1/3]

LogMessage::LogMessage ( LogLevel  _level,
std::string const &  _type,
std::string_view  _text 
)
22 : level(_level), type(_type), text(std::string(_text)), mtime(GetEpochTime()) { }
Seconds GetEpochTime()
Definition: Timer.h:141
Seconds mtime
Definition: LogMessage.h:42
LogLevel const level
Definition: LogMessage.h:37
std::string const text
Definition: LogMessage.h:39
std::string const type
Definition: LogMessage.h:38

◆ LogMessage() [2/3]

LogMessage::LogMessage ( LogLevel  _level,
std::string const &  _type,
std::string_view  _text,
std::string_view  _param1 
)
25 : level(_level), type(_type), text(std::string(_text)), param1(std::string(_param1)), mtime(GetEpochTime()) { }
std::string param1
Definition: LogMessage.h:41

◆ LogMessage() [3/3]

LogMessage::LogMessage ( LogMessage const &  )
delete

Member Function Documentation

◆ getTimeStr() [1/2]

std::string LogMessage::getTimeStr ( ) const
33{
34 return getTimeStr(mtime);
35}
std::string getTimeStr() const
Definition: LogMessage.cpp:32

References getTimeStr(), and mtime.

Referenced by getTimeStr(), and AppenderFile::OpenFile().

◆ getTimeStr() [2/2]

std::string LogMessage::getTimeStr ( Seconds  time)
static
28{
29 return Acore::Time::TimeToTimestampStr(time, "%Y-%m-%d %X");
30}
AC_COMMON_API std::string TimeToTimestampStr(Seconds time=0s, std::string_view fmt={})
Definition: Timer.cpp:272

References Acore::Time::TimeToTimestampStr().

Referenced by Appender::write().

◆ operator=()

LogMessage & LogMessage::operator= ( LogMessage const &  )
delete

◆ Size()

uint32 LogMessage::Size ( ) const
inline

@ Returns size of the log message content in bytes

46 {
47 return static_cast<uint32>(prefix.size() + text.size());
48 }
std::uint32_t uint32
Definition: Define.h:107
std::string prefix
Definition: LogMessage.h:40

References prefix, and text.

Referenced by AppenderFile::_write().

Member Data Documentation

◆ level

LogLevel const LogMessage::level

◆ mtime

Seconds LogMessage::mtime

Referenced by AppenderDB::_write(), and getTimeStr().

◆ param1

std::string LogMessage::param1

Referenced by AppenderFile::_write().

◆ prefix

std::string LogMessage::prefix

◆ text

std::string const LogMessage::text

◆ type

std::string const LogMessage::type