Calamity Engine 1.0.0
A cross-platform 2D game engine written in C++ and SDL3.
Loading...
Searching...
No Matches
logger.hpp
Go to the documentation of this file.
1#pragma once
2#include <spdlog/spdlog.h>
3#include <memory>
4#include <string>
5
21class Logger
22{
23public:
24 static void init(const std::string &name = "Calamity");
25 static void exit();
26
27 template <typename... Args>
28 static void info(fmt::format_string<Args...> fmt, Args &&...args)
29 {
30 s_Logger->info(fmt, std::forward<Args>(args)...);
31 }
32 template <typename... Args>
33 static void warn(fmt::format_string<Args...> fmt, Args &&...args)
34 {
35 s_Logger->warn(fmt, std::forward<Args>(args)...);
36 }
37 template <typename... Args>
38 static void error(fmt::format_string<Args...> fmt, Args &&...args)
39 {
40 s_Logger->error(fmt, std::forward<Args>(args)...);
41 }
42 template <typename... Args>
43 static void debug(fmt::format_string<Args...> fmt, Args &&...args)
44 {
45 s_Logger->debug(fmt, std::forward<Args>(args)...);
46 }
47
48private:
49 static std::shared_ptr<spdlog::logger> s_Logger;
50};
Definition logger.hpp:22
static void exit()
Definition logger.cpp:13
static void debug(fmt::format_string< Args... > fmt, Args &&...args)
Definition logger.hpp:43
static void warn(fmt::format_string< Args... > fmt, Args &&...args)
Definition logger.hpp:33
static void init(const std::string &name="Calamity")
Definition logger.cpp:6
static void info(fmt::format_string< Args... > fmt, Args &&...args)
Definition logger.hpp:28
static void error(fmt::format_string< Args... > fmt, Args &&...args)
Definition logger.hpp:38