6#include <spdlog/spdlog.h>
7#include <spdlog/sinks/stdout_color_sinks.h>
13 #define EE_TRACE_PREFIX "[TRACE] "
14 #define EE_INFO_PREFIX "[INFO] "
15 #define EE_WARN_PREFIX "[WARN] "
16 #define EE_ERROR_PREFIX "[ERROR] "
17 #define EE_FATAL_PREFIX "[FATAL] "
19 #define EE_TRACE_PREFIX ""
20 #define EE_INFO_PREFIX ""
21 #define EE_WARN_PREFIX ""
22 #define EE_ERROR_PREFIX ""
23 #define EE_FATAL_PREFIX ""
29 LogImpl(std::shared_ptr<spdlog::logger> logger) : m_logger(logger) { }
36 std::shared_ptr<spdlog::logger> m_logger;
41 static inline void Trace(
LogImpl* logger,
const std::string& text) {
if(logger) logger->
Trace(text); }
42 static inline void Info(
LogImpl* logger,
const std::string& text) {
if(logger) logger->
Info(text); }
43 static inline void Warn(
LogImpl* logger,
const std::string& text) {
if(logger) logger->
Warn(text); }
44 static inline void Error(
LogImpl* logger,
const std::string& text) {
if(logger) logger->
Error(text); }
45 static inline void Fatal(
LogImpl* logger,
const std::string& text) {
if(logger) logger->
Fatal(text); }
52#if defined(EE_ENGINE_BUILD) || defined(EE_ENGINE_INTERNAL)
53#define EE_CORE_TRACE(...) ::Elevate::Log::Trace(::Elevate::Log::GetCoreLogger(), std::format(__VA_ARGS__))
54#define EE_CORE_INFO(...) ::Elevate::Log::Info(::Elevate::Log::GetCoreLogger(), std::format(__VA_ARGS__))
55#define EE_CORE_WARN(...) ::Elevate::Log::Warn(::Elevate::Log::GetCoreLogger(), std::format(__VA_ARGS__))
56#define EE_CORE_ERROR(...) ::Elevate::Log::Error(::Elevate::Log::GetCoreLogger(), std::format(__VA_ARGS__))
57#define EE_CORE_FATAL(...) ::Elevate::Log::Fatal(::Elevate::Log::GetCoreLogger(), std::format(__VA_ARGS__))
59#define EE_CORE_CTRACE(condition, ...) if(condition) { EE_CORE_TRACE(__VA_ARGS__); }
60#define EE_CORE_CINFO(condition, ...) if(condition) { EE_CORE_INFO(__VA_ARGS__); }
61#define EE_CORE_CWARN(condition, ...) if(condition) { EE_CORE_WARN(__VA_ARGS__); }
62#define EE_CORE_CERROR(condition, ...) if(condition) { EE_CORE_ERROR(__VA_ARGS__); }
63#define EE_CORE_CFATAL(condition, ...) if(condition) { EE_CORE_FATAL(__VA_ARGS__); }
66#define EE_TRACE(...) ::Elevate::Log::Trace(::Elevate::Log::GetClientLogger(), std::format(__VA_ARGS__))
67#define EE_INFO(...) ::Elevate::Log::Info(::Elevate::Log::GetClientLogger(), std::format(__VA_ARGS__))
68#define EE_WARN(...) ::Elevate::Log::Warn(::Elevate::Log::GetClientLogger(), std::format(__VA_ARGS__))
69#define EE_ERROR(...) ::Elevate::Log::Error(::Elevate::Log::GetClientLogger(), std::format(__VA_ARGS__))
70#define EE_FATAL(...) ::Elevate::Log::Fatal(::Elevate::Log::GetClientLogger(), std::format(__VA_ARGS__))
72#define EE_CTRACE(condition, ...) if(condition) { EE_TRACE(__VA_ARGS__); }
73#define EE_CINFO(condition, ...) if(condition) { EE_INFO(__VA_ARGS__); }
74#define EE_CWARN(condition, ...) if(condition) { EE_WARN(__VA_ARGS__); }
75#define EE_CERROR(condition, ...) if(condition) { EE_ERROR(__VA_ARGS__); }
76#define EE_CFATAL(condition, ...) if(condition) { EE_FATAL(__VA_ARGS__); }
void Fatal(const std::string &text)
void Warn(const std::string &text)
void Info(const std::string &text)
LogImpl(std::shared_ptr< spdlog::logger > logger)
void Error(const std::string &text)
void Trace(const std::string &text)
static LogImpl * GetCoreLogger()
static void Error(LogImpl *logger, const std::string &text)
static void Trace(LogImpl *logger, const std::string &text)
static void Info(LogImpl *logger, const std::string &text)
static void Warn(LogImpl *logger, const std::string &text)
static void Fatal(LogImpl *logger, const std::string &text)
static LogImpl * GetClientLogger()