AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Log.h File Reference
#include "IoContext.h"
#include "Define.h"
#include "LogCommon.h"
#include "StringFormat.h"
#include <unordered_map>
#include <vector>

Go to the source code of this file.

Classes

class  Log
 

Namespaces

namespace  Acore
 
namespace  Acore::Asio
 

Macros

#define LOGGER_ROOT   "root"
 
#define sLog   Log::instance()
 
#define LOG_EXCEPTION_FREE(filterType__, level__, ...)
 
#define LOG_MESSAGE_BODY(filterType__, level__, ...)
 
#define LOG_FATAL(filterType__, ...)    LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_FATAL, __VA_ARGS__)
 
#define LOG_ERROR(filterType__, ...)    LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_ERROR, __VA_ARGS__)
 
#define LOG_WARN(filterType__, ...)    LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_WARN, __VA_ARGS__)
 
#define LOG_INFO(filterType__, ...)    LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_INFO, __VA_ARGS__)
 
#define LOG_DEBUG(filterType__, ...)    LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_DEBUG, __VA_ARGS__)
 
#define LOG_TRACE(filterType__, ...)    LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_TRACE, __VA_ARGS__)
 
#define LOG_GM(accountId__, ...)    sLog->outCommand(accountId__, __VA_ARGS__)
 

Typedefs

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

Functions

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

Macro Definition Documentation

◆ LOG_DEBUG

#define LOG_DEBUG (   filterType__,
  ... 
)     LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_DEBUG, __VA_ARGS__)

◆ LOG_ERROR

#define LOG_ERROR (   filterType__,
  ... 
)     LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_ERROR, __VA_ARGS__)

◆ LOG_EXCEPTION_FREE

#define LOG_EXCEPTION_FREE (   filterType__,
  level__,
  ... 
)
Value:
{ \
try \
{ \
sLog->outMessage(filterType__, level__, fmt::format(__VA_ARGS__)); \
} \
catch (std::exception const& e) \
{ \
sLog->outMessage("server", LogLevel::LOG_LEVEL_ERROR, "Wrong format occurred ({}) at '{}:{}'", \
e.what(), __FILE__, __LINE__); \
} \
}
#define sLog
Definition: Log.h:126
@ LOG_LEVEL_ERROR
Definition: LogCommon.h:28

◆ LOG_FATAL

#define LOG_FATAL (   filterType__,
  ... 
)     LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_FATAL, __VA_ARGS__)

◆ LOG_GM

#define LOG_GM (   accountId__,
  ... 
)     sLog->outCommand(accountId__, __VA_ARGS__)

◆ LOG_INFO

#define LOG_INFO (   filterType__,
  ... 
)     LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_INFO, __VA_ARGS__)

◆ LOG_MESSAGE_BODY

#define LOG_MESSAGE_BODY (   filterType__,
  level__,
  ... 
)
Value:
do \
{ \
if (sLog->ShouldLog(filterType__, level__)) \
LOG_EXCEPTION_FREE(filterType__, level__, __VA_ARGS__); \
} while (0)

◆ LOG_TRACE

#define LOG_TRACE (   filterType__,
  ... 
)     LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_TRACE, __VA_ARGS__)

◆ LOG_WARN

#define LOG_WARN (   filterType__,
  ... 
)     LOG_MESSAGE_BODY(filterType__, LogLevel::LOG_LEVEL_WARN, __VA_ARGS__)

◆ LOGGER_ROOT

#define LOGGER_ROOT   "root"

◆ sLog

#define sLog   Log::instance()

Typedef Documentation

◆ AppenderCreatorFn

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

Function Documentation

◆ CreateAppender()

template<class AppenderImpl >
Appender * CreateAppender ( uint8  id,
std::string const &  name,
LogLevel  level,
AppenderFlags  flags,
std::vector< std::string_view > const &  extraArgs 
)
44{
45 return new AppenderImpl(id, name, level, flags, extraArgs);
46}