refactor: extract logger to separate module

This commit is contained in:
light7734 2025-07-07 15:54:55 +03:30
parent 2341be0c70
commit d8f656d98b
Signed by: light7734
GPG key ID: 8C30176798F1A6BA
7 changed files with 9 additions and 11 deletions

View file

@ -1,3 +1,5 @@
add_subdirectory(./logger)
add_subdirectory(./asset_baker) add_subdirectory(./asset_baker)
add_subdirectory(./asset_parser) add_subdirectory(./asset_parser)

View file

@ -9,7 +9,6 @@ if(NOT WIN32)
core/uuid.cpp core/uuid.cpp
debug/exceptions.cpp debug/exceptions.cpp
debug/instrumentor.cpp debug/instrumentor.cpp
debug/logger.cpp
graphics/blender.cpp graphics/blender.cpp
graphics/buffers.cpp graphics/buffers.cpp
graphics/framebuffer.cpp graphics/framebuffer.cpp
@ -53,7 +52,6 @@ else()
core/uuid.cpp core/uuid.cpp
debug/exceptions.cpp debug/exceptions.cpp
debug/instrumentor.cpp debug/instrumentor.cpp
debug/logger.cpp
graphics/blender.cpp graphics/blender.cpp
graphics/buffers.cpp graphics/buffers.cpp
graphics/framebuffer.cpp graphics/framebuffer.cpp
@ -102,9 +100,9 @@ endif()
target_link_libraries( target_link_libraries(
engine engine
PUBLIC glad PUBLIC glad
PUBLIC logger
PUBLIC opengl::opengl PUBLIC opengl::opengl
PUBLIC glfw PUBLIC glfw
PUBLIC spdlog::spdlog
PUBLIC imgui PUBLIC imgui
PUBLIC stb::stb PUBLIC stb::stb
PUBLIC yaml-cpp::yaml-cpp PUBLIC yaml-cpp::yaml-cpp

View file

@ -95,7 +95,7 @@ auto linux_only(auto value)
{ \ { \
if (!(x)) \ if (!(x)) \
{ \ { \
log_crt(__VA_ARGS__); \ log_crt(__VA_ARGS__); \
lt_debug_trap(); \ lt_debug_trap(); \
throw ::Light::FailedAssertion(__FILE__, __LINE__); \ throw ::Light::FailedAssertion(__FILE__, __LINE__); \
} \ } \
@ -122,7 +122,7 @@ constexpr auto bit(auto x)
/* debug */ /* debug */
#ifndef LIGHT_LOGGER_H #ifndef LIGHT_LOGGER_H
#include <engine/debug/logger.hpp> #include <logger/logger.hpp>
#endif #endif
#include <engine/debug/exceptions.hpp> #include <engine/debug/exceptions.hpp>

View file

@ -8,7 +8,7 @@
#include <engine/camera/camera.hpp> #include <engine/camera/camera.hpp>
// debug // debug
#include <engine/debug/logger.hpp> #include <logger/logger.hpp>
// events // events
#include <engine/events/char.hpp> #include <engine/events/char.hpp>

View file

@ -0,0 +1,2 @@
add_library_module(logger logger.cpp)
target_link_libraries(logger PUBLIC spdlog::spdlog)

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include <any>
#include <format> #include <format>
#include <memory> #include <memory>
#include <spdlog/sinks/basic_file_sink.h> #include <spdlog/sinks/basic_file_sink.h>

View file

@ -1,7 +1,4 @@
#include <engine/debug/logger.hpp> #include <logger/logger.hpp>
#include <spdlog/sinks/basic_file_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
Logger::Logger(): spd_logger(spdlog::stdout_color_mt("Logger")) Logger::Logger(): spd_logger(spdlog::stdout_color_mt("Logger"))
{ {