refactor: remove spdlog dependency
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				continuous-integration/drone/push Build is failing
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	continuous-integration/drone/push Build is failing
				
			This commit is contained in:
		
							parent
							
								
									207cd48a7a
								
							
						
					
					
						commit
						8268a07e1b
					
				
					 8 changed files with 11 additions and 48 deletions
				
			
		| 
						 | 
					@ -26,7 +26,6 @@ class LightRecipe(ConanFile):
 | 
				
			||||||
        self.requires("entt/3.15.0")
 | 
					        self.requires("entt/3.15.0")
 | 
				
			||||||
        self.requires("glfw/3.4")
 | 
					        self.requires("glfw/3.4")
 | 
				
			||||||
        self.requires("glm/1.0.1")
 | 
					        self.requires("glm/1.0.1")
 | 
				
			||||||
        self.requires("spdlog/1.15.3")
 | 
					 | 
				
			||||||
        self.requires("stb/cci.20240531")
 | 
					        self.requires("stb/cci.20240531")
 | 
				
			||||||
        self.requires("yaml-cpp/0.8.0")
 | 
					        self.requires("yaml-cpp/0.8.0")
 | 
				
			||||||
        self.requires("lz4/1.10.0")
 | 
					        self.requires("lz4/1.10.0")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,2 @@
 | 
				
			||||||
add_library_module(input input.cpp)
 | 
					add_library_module(input input.cpp)
 | 
				
			||||||
target_link_libraries(input PUBLIC spdlog::spdlog glm::glm imgui logger)
 | 
					target_link_libraries(input PUBLIC glm::glm imgui logger)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1 @@
 | 
				
			||||||
add_library_module(logger logger.cpp)
 | 
					add_library_module(logger logger.cpp)
 | 
				
			||||||
target_link_libraries(logger PUBLIC spdlog::spdlog)
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,15 +1,9 @@
 | 
				
			||||||
#pragma once
 | 
					#pragma once
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <format>
 | 
					#include <format>
 | 
				
			||||||
#include <memory>
 | 
					#include <print>
 | 
				
			||||||
#include <spdlog/sinks/basic_file_sink.h>
 | 
					 | 
				
			||||||
#include <spdlog/sinks/stdout_color_sinks.h>
 | 
					 | 
				
			||||||
#include <spdlog/spdlog.h>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** @brief Severity of a log message.
 | 
					/** Severity of a log message. */
 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @note Values reflect spdlog::lvl
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
enum class LogLvl : uint8_t
 | 
					enum class LogLvl : uint8_t
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	/** Lowest and most vebose log level, for tracing execution paths and events */
 | 
						/** Lowest and most vebose log level, for tracing execution paths and events */
 | 
				
			||||||
| 
						 | 
					@ -34,11 +28,7 @@ enum class LogLvl : uint8_t
 | 
				
			||||||
	off = 6,
 | 
						off = 6,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
namespace spdlog {
 | 
					/** Simple console logger */
 | 
				
			||||||
class logger;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/** Responsible for logging */
 | 
					 | 
				
			||||||
class Logger
 | 
					class Logger
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
| 
						 | 
					@ -47,26 +37,19 @@ public:
 | 
				
			||||||
	template<typename... Args>
 | 
						template<typename... Args>
 | 
				
			||||||
	void static log(LogLvl lvl, std::format_string<Args...> fmt, Args &&...args)
 | 
						void static log(LogLvl lvl, std::format_string<Args...> fmt, Args &&...args)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		instance().spd_logger->log(
 | 
							std::ignore = lvl;
 | 
				
			||||||
		    (spdlog::level::level_enum)lvl,
 | 
							std::println(fmt, std::forward<Args>(args)...);
 | 
				
			||||||
		    std::format(fmt, std::forward<Args>(args)...)
 | 
					 | 
				
			||||||
		);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	void static log(LogLvl lvl, const char *message)
 | 
						void static log(LogLvl lvl, const char *message)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		instance().spd_logger->log((spdlog::level::level_enum)lvl, message);
 | 
							std::ignore = lvl;
 | 
				
			||||||
 | 
							std::println("{}", message);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
	Logger();
 | 
						Logger() = default;
 | 
				
			||||||
 | 
					 | 
				
			||||||
	~Logger();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	auto static instance() -> Logger &;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	std::shared_ptr<spdlog::logger> spd_logger;
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template<typename... Args>
 | 
					template<typename... Args>
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,18 +1 @@
 | 
				
			||||||
#include <logger/logger.hpp>
 | 
					#include <logger/logger.hpp>
 | 
				
			||||||
 | 
					 | 
				
			||||||
Logger::Logger(): spd_logger(spdlog::stdout_color_mt("Logger"))
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	spd_logger->set_pattern("%^%v%$");
 | 
					 | 
				
			||||||
	spd_logger->set_level(spdlog::level::level_enum::trace);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Logger::~Logger()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	spdlog::drop_all();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
auto Logger::instance() -> Logger &
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	static auto logger = Logger {};
 | 
					 | 
				
			||||||
	return logger;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,7 +154,7 @@ void AssetBrowserPanel::on_user_interface_update()
 | 
				
			||||||
			default: break;
 | 
								default: break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// Label
 | 
								// Label
 | 
				
			||||||
			ImGui::TextUnformatted(fmt::format("{}", path.filename().string()).c_str());
 | 
								ImGui::TextUnformatted(std::format("{}", path.filename().string()).c_str());
 | 
				
			||||||
			ImGui::PopID();
 | 
								ImGui::PopID();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,2 @@
 | 
				
			||||||
add_library_module(ui ui.cpp gl/ui.cpp)
 | 
					add_library_module(ui ui.cpp gl/ui.cpp)
 | 
				
			||||||
target_link_libraries(ui PUBLIC spdlog::spdlog imgui renderer logger lt_debug)
 | 
					target_link_libraries(ui PUBLIC imgui renderer logger lt_debug)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,6 +1,5 @@
 | 
				
			||||||
find_package(glfw3 REQUIRED)
 | 
					find_package(glfw3 REQUIRED)
 | 
				
			||||||
find_package(glm REQUIRED)
 | 
					find_package(glm REQUIRED)
 | 
				
			||||||
find_package(spdlog REQUIRED)
 | 
					 | 
				
			||||||
find_package(stb REQUIRED)
 | 
					find_package(stb REQUIRED)
 | 
				
			||||||
find_package(yaml-cpp REQUIRED)
 | 
					find_package(yaml-cpp REQUIRED)
 | 
				
			||||||
find_package(EnTT REQUIRED)
 | 
					find_package(EnTT REQUIRED)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue