Karma Engine
Loading...
Searching...
No Matches
Log.h
1#pragma once
2
3#include "krpch.h"
4
5#include "spdlog/spdlog.h"
6#include "spdlog/sinks/stdout_color_sinks.h"
7#include "spdlog/fmt/ostr.h"
8
9namespace Karma
10{
11 class KARMA_API Log
12 {
13 public:
14 static void Init();
15 inline static std::shared_ptr<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
16 inline static std::shared_ptr<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }
17
18 private:
19 static std::shared_ptr<spdlog::logger> s_CoreLogger;
20 static std::shared_ptr<spdlog::logger> s_ClientLogger;
21 };
22}
23
24// Core log macros
25#define KR_CORE_ERROR(...) ::Karma::Log::GetCoreLogger()->error(__VA_ARGS__)
26#define KR_CORE_WARN(...) ::Karma::Log::GetCoreLogger()->warn(__VA_ARGS__)
27#define KR_CORE_INFO(...) ::Karma::Log::GetCoreLogger()->info(__VA_ARGS__)
28#define KR_CORE_TRACE(...) ::Karma::Log::GetCoreLogger()->trace(__VA_ARGS__)
29#define KR_CORE_FATAL(...) ::Karma::Log::GetCoreLogger()->fatal(__VA_ARGS__)
30
31// Client log macros
32#define KR_ERROR(...) ::Karma::Log::GetClientLogger()->error(__VA_ARGS__)
33#define KR_WARN(...) ::Karma::Log::GetClientLogger()->warn(__VA_ARGS__)
34#define KR_INFO(...) ::Karma::Log::GetClientLogger()->info(__VA_ARGS__)
35#define KR_TRACE(...) ::Karma::Log::GetClientLogger()->trace(__VA_ARGS__)
36#define KR_FATAL(...) ::Karma::Log::GetClientLogger()->fatal(__VA_ARGS__)
Definition Log.h:12