mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
refactor: logger (#35)
* refactor(log): convert Logger from namespace to class with static methods - Replace the Logger namespace of free functions with a Logger class containing static methods (info, error, warn, debug). - Simplify log calls by removing explicit source_location parameters; adopt `std::print` for output formatting. - Undefine common macro names (DEBUG, INFO, ERROR, WARN) to avoid collisions. - Update `renderer.cpp` to use `Logger::debug` instead of the old `Logger::log`. - Add missing `#include <source_location>` in `audio_error.hpp`. - Fix early return condition in `WorldScene::set_pause`. * refactor(camera): remove reset_camera method and first-mouse flag * refactor: replace --no-debug with logging options, add assertions, fix typo - Removed `--no-debug` CLI flag and added `--logs-path`, `--log-level`, `--enable-filelog`, `--enable-consolelog`. - Added file logging support with daily rotation, log level threshold, and console/file output control. - Added `m_init` check in `Config::get`/`set` to prevent use before initialization. - Fixed typo in `DebugCollector::destroy` (`distory` → `destory`). - Removed `debug_on` parameter from `Renderer::init`; OpenGL debug output is now unconditionally enabled in debug builds. * feat(debug): enable GL debug context flag in debug builds
This commit is contained in:
@@ -238,6 +238,10 @@ void Window::init(const Argument& argument) {
|
||||
|
||||
SDL_SetWindowPosition(m_window, SDL_WINDOWPOS_CENTERED,
|
||||
SDL_WINDOWPOS_CENTERED);
|
||||
#ifdef DEBUG_MODE
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
|
||||
Logger::debug("Debug Flag On");
|
||||
#endif
|
||||
}
|
||||
|
||||
void Window::reload_config() {
|
||||
@@ -298,9 +302,6 @@ void Window::enable_mouse() {
|
||||
}
|
||||
void Window::disable_mouse() {
|
||||
SDL_SetWindowRelativeMouseMode(m_window, true);
|
||||
if (m_camera) {
|
||||
m_camera->reset_camera();
|
||||
}
|
||||
m_mouse_enable = false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user