- Logger now logs it's info on Init

- Fixed a mistake from previous commit
This commit is contained in:
Light 2021-06-14 10:20:59 +04:30
parent 612b382f30
commit cd9747ccfe
5 changed files with 53 additions and 25 deletions

View file

@ -3,6 +3,8 @@
#include <spdlog/sinks/stdout_color_sinks.h>
#include "Utility/Stringifier.h"
namespace Light {
std::shared_ptr<spdlog::logger> Logger::s_EngineLogger = nullptr;
@ -19,6 +21,13 @@ namespace Light {
s_ClientLogger = spdlog::stdout_color_mt("Client");
s_ClientLogger->set_level(spdlog::level::trace);
LT_ENGINE_INFO("________________________________________");
LT_ENGINE_INFO("Logger::");
LT_ENGINE_INFO(" ClientLevel: {}", Stringifier::spdlogLevel(s_ClientLogger->level()));
LT_ENGINE_INFO(" EngineLevel: {}", Stringifier::spdlogLevel(s_EngineLogger->level()));
LT_ENGINE_INFO(" DefaultLevel: {}", Stringifier::spdlogLevel(spdlog::get_level()));
LT_ENGINE_INFO("________________________________________");
}
}

View file

@ -21,7 +21,7 @@ namespace Light {
bool b_Open;
public:
static Window* Create(const WindowProperties& properties, std::function<void(Event&)> callback);
static Window* Create(std::function<void(Event&)> callback);
Window(const Window&) = delete;
Window& operator=(const Window&) = delete;

View file

@ -3,6 +3,8 @@
#include <glad/glad.h>
#include <spdlog/common.h>
namespace Light {
std::string Stringifier::glDebugMsgSeverity(unsigned int severity)
@ -48,4 +50,19 @@ namespace Light {
}
}
std::string Stringifier::spdlogLevel(unsigned int level)
{
switch (level)
{
case SPDLOG_LEVEL_TRACE: return "SPDLOG_LEVEL_TRACE";
case SPDLOG_LEVEL_DEBUG: return "SPDLOG_LEVEL_DEBUG";
case SPDLOG_LEVEL_INFO: return "SPDLOG_LEVEL_INFO";
case SPDLOG_LEVEL_WARN: return "SPDLOG_LEVEL_WARN";
case SPDLOG_LEVEL_ERROR: return "SPDLOG_LEVEL_ERROR";
case SPDLOG_LEVEL_CRITICAL: return "SPDLOG_LEVEL_CRITICAL";
case SPDLOG_LEVEL_OFF: return "SPDLOG_LEVEL_OFF";
default: return "UNKNOWN";
}
}
}

View file

@ -10,6 +10,8 @@ namespace Light {
static std::string glDebugMsgSeverity(unsigned int severity);
static std::string glDebugMsgSource(unsigned int source);
static std::string glDebugMsgType(unsigned int type);
static std::string spdlogLevel(unsigned int level);
};
}

View file

@ -12,9 +12,9 @@
namespace Light {
Window* Window::Create(const WindowProperties& properties, std::function<void(Event&)> callback)
Window* Window::Create(std::function<void(Event&)> callback)
{
return new wWindow(properties, callback);
return new wWindow(callback);
}
wWindow::wWindow(std::function<void(Event&)> callback)