63 lines
2.3 KiB
C++
Executable File
63 lines
2.3 KiB
C++
Executable File
#pragma once
|
|
#include "spdlog/sinks/stdout_color_sinks.h"
|
|
#include "spdlog/spdlog.h"
|
|
|
|
namespace spdlog {
|
|
class logger;
|
|
}
|
|
|
|
// Simple file to define logs functions optimized depending on the compilation
|
|
|
|
namespace Deer {
|
|
namespace Log {
|
|
void init();
|
|
void shutdown();
|
|
|
|
void coreTrace(const char* msg);
|
|
|
|
spdlog::logger* getCoreLogger();
|
|
spdlog::logger* getClientLogger();
|
|
spdlog::logger* getScriptLogger();
|
|
spdlog::logger* getEditorEngineLogger();
|
|
}; // namespace Log
|
|
} // namespace Deer
|
|
|
|
#define DEER_CORE_TRACE(...) Deer::Log::getCoreLogger()->trace(__VA_ARGS__)
|
|
#define DEER_CORE_INFO(...) Deer::Log::getCoreLogger()->info(__VA_ARGS__)
|
|
#define DEER_CORE_WARN(...) Deer::Log::getCoreLogger()->warn(__VA_ARGS__)
|
|
#define DEER_CORE_ERROR(...) Deer::Log::getCoreLogger()->error(__VA_ARGS__)
|
|
|
|
#define DEER_SCRIPT_TRACE(...) Deer::Log::getScriptLogger()->trace(__VA_ARGS__)
|
|
#define DEER_SCRIPT_INFO(...) Deer::Log::getScriptLogger()->info(__VA_ARGS__)
|
|
#define DEER_SCRIPT_WARN(...) Deer::Log::getScriptLogger()->warn(__VA_ARGS__)
|
|
#define DEER_SCRIPT_ERROR(...) Deer::Log::getScriptLogger()->error(__VA_ARGS__)
|
|
|
|
#define DEER_EDITOR_ENGINE_TRACE(...) Deer::Log::getEditorEngineLogger()->trace(__VA_ARGS__)
|
|
#define DEER_EDITOR_ENGINE_INFO(...) Deer::Log::getEditorEngineLogger()->info(__VA_ARGS__)
|
|
#define DEER_EDITOR_ENGINE_WARN(...) Deer::Log::getEditorEngineLogger()->warn(__VA_ARGS__)
|
|
#define DEER_EDITOR_ENGINE_ERROR(...) Deer::Log::getEditorEngineLogger()->error(__VA_ARGS__)
|
|
|
|
#ifdef LINUX
|
|
#define DEER_CORE_ASSERT(condition, ...) \
|
|
if (!(condition)) { \
|
|
Deer::Log::getCoreLogger()->error(__VA_ARGS__); \
|
|
__builtin_trap(); \
|
|
}
|
|
#define DEER_SCRIPT_ASSERT(condition, ...) \
|
|
if (!(condition)) { \
|
|
Deer::Log::getScriptLogger()->error(__VA_ARGS__); \
|
|
}
|
|
#endif
|
|
#ifdef WINDOWS
|
|
#define DEER_CORE_ASSERT(condition, ...) \
|
|
if (!(condition)) { \
|
|
Deer::Log::getCoreLogger()->error(__VA_ARGS__); \
|
|
__debugbreak(); \
|
|
}
|
|
#define DEER_SCRIPT_ASSERT(condition, ...) \
|
|
if (!(condition)) { \
|
|
Deer::Log::getScriptLogger()->error(__VA_ARGS__); \
|
|
__debugbreak(); \
|
|
}
|
|
#endif
|