TrinityCore
Loading...
Searching...
No Matches
Log.h File Reference
#include "Define.h"
#include "AsioHacksFwd.h"
#include "LogCommon.h"
#include "StringFormat.h"
#include <memory>
#include <unordered_map>
#include <vector>
+ Include dependency graph for Log.h:

Go to the source code of this file.

Classes

class  Log
 

Namespaces

namespace  Trinity
 
namespace  Trinity::Asio
 

Macros

#define LOGGER_ROOT   "root"
 
#define sLog   Log::instance()
 
#define TC_LOG_MESSAGE_BODY_CORE(filterType__, level__, message__, ...)
 
#define TC_LOG_MESSAGE_BODY(filterType__, level__, message__, ...)
 
#define TC_LOG_TRACE(filterType__, message__, ...)    TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_TRACE, message__, ## __VA_ARGS__)
 
#define TC_LOG_DEBUG(filterType__, message__, ...)    TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_DEBUG, message__, ## __VA_ARGS__)
 
#define TC_LOG_INFO(filterType__, message__, ...)    TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_INFO, message__, ## __VA_ARGS__)
 
#define TC_LOG_WARN(filterType__, message__, ...)    TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_WARN, message__, ## __VA_ARGS__)
 
#define TC_LOG_ERROR(filterType__, message__, ...)    TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_ERROR, message__, ## __VA_ARGS__)
 
#define TC_LOG_FATAL(filterType__, message__, ...)    TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_FATAL, message__, ## __VA_ARGS__)
 

Typedefs

typedef Appender *(* AppenderCreatorFn) (uint8 id, std::string name, LogLevel level, AppenderFlags flags, std::vector< std::string_view > const &extraArgs)
 

Functions

template<class AppenderImpl >
AppenderCreateAppender (uint8 id, std::string name, LogLevel level, AppenderFlags flags, std::vector< std::string_view > const &extraArgs)
 

Macro Definition Documentation

◆ LOGGER_ROOT

#define LOGGER_ROOT   "root"

Definition at line 41 of file Log.h.

◆ sLog

#define sLog   Log::instance()

Definition at line 156 of file Log.h.

◆ TC_LOG_DEBUG

#define TC_LOG_DEBUG (   filterType__,
  message__,
  ... 
)     TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_DEBUG, message__, ## __VA_ARGS__)

Definition at line 181 of file Log.h.

◆ TC_LOG_ERROR

#define TC_LOG_ERROR (   filterType__,
  message__,
  ... 
)     TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_ERROR, message__, ## __VA_ARGS__)

Definition at line 190 of file Log.h.

◆ TC_LOG_FATAL

#define TC_LOG_FATAL (   filterType__,
  message__,
  ... 
)     TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_FATAL, message__, ## __VA_ARGS__)

Definition at line 193 of file Log.h.

◆ TC_LOG_INFO

#define TC_LOG_INFO (   filterType__,
  message__,
  ... 
)     TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_INFO, message__, ## __VA_ARGS__)

Definition at line 184 of file Log.h.

◆ TC_LOG_MESSAGE_BODY

#define TC_LOG_MESSAGE_BODY (   filterType__,
  level__,
  message__,
  ... 
)
Value:
__pragma(warning(push)) \
__pragma(warning(disable:4127)) \
TC_LOG_MESSAGE_BODY_CORE(filterType__, level__, message__, ## __VA_ARGS__) \
__pragma(warning(pop))
#define TC_LOG_MESSAGE_BODY_CORE(filterType__, level__, message__,...)
Definition Log.h:158

Definition at line 171 of file Log.h.

◆ TC_LOG_MESSAGE_BODY_CORE

#define TC_LOG_MESSAGE_BODY_CORE (   filterType__,
  level__,
  message__,
  ... 
)
Value:
do { \
Log* logInstance = sLog; \
if (Logger const* loggerInstance = logInstance->GetEnabledLogger(Log::make_string_view((filterType__)), (level__))) \
logInstance->OutMessageTo(loggerInstance, Log::make_string_view((filterType__)), (level__), \
Log::make_format_string_view((message__)), ## __VA_ARGS__); \
} while (0)
#define sLog
Definition Log.h:156
Definition Log.h:52
static constexpr std::string_view make_string_view(StringOrStringView const &stringOrStringView)
Definition Log.h:112
Logger const * GetEnabledLogger(std::string_view type, LogLevel level) const noexcept
Definition Log.cpp:348
void OutMessageTo(Logger const *logger, std::string_view filter, LogLevel level, Trinity::FormatString< Args... > fmt, Args &&... args) noexcept
Definition Log.h:81
static consteval Trinity::FormatStringView make_format_string_view(char const(&chars)[CharArraySize])
Definition Log.h:124

Definition at line 158 of file Log.h.

◆ TC_LOG_TRACE

#define TC_LOG_TRACE (   filterType__,
  message__,
  ... 
)     TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_TRACE, message__, ## __VA_ARGS__)

Definition at line 178 of file Log.h.

◆ TC_LOG_WARN

#define TC_LOG_WARN (   filterType__,
  message__,
  ... 
)     TC_LOG_MESSAGE_BODY(filterType__, LOG_LEVEL_WARN, message__, ## __VA_ARGS__)

Definition at line 187 of file Log.h.

Typedef Documentation

◆ AppenderCreatorFn

typedef Appender *(* AppenderCreatorFn) (uint8 id, std::string name, LogLevel level, AppenderFlags flags, std::vector< std::string_view > const &extraArgs)

Definition at line 43 of file Log.h.

Function Documentation

◆ CreateAppender()

template<class AppenderImpl >
Appender * CreateAppender ( uint8  id,
std::string  name,
LogLevel  level,
AppenderFlags  flags,
std::vector< std::string_view > const &  extraArgs 
)

Definition at line 46 of file Log.h.