feat: Enhance logging system with platform-specific error handling and trace functionality

- Added platform detection and user configuration directory retrieval in platform.cpp and platform.hpp.
- Implemented detailed error reporting for Windows in platform.cpp.
- Updated logger to use std::source_location for improved trace logging in logger.hpp.
- Refactored existing trace guards in various application files to remove function name parameters, utilizing the new logger functionality.
- Introduced a new script (add_traces.sh) to automate the addition of logging includes in relevant source files.
- Enhanced audio_player.cpp and other script files to include detailed logging for function entries and variable states.
This commit is contained in:
2026-01-04 01:38:31 +00:00
parent 198179bfca
commit d8d1c0a557
24 changed files with 211 additions and 103 deletions

View File

@@ -10,7 +10,7 @@
namespace sdl3cpp::script {
void LuaBindings::RegisterBindings(lua_State* L, ScriptEngine* engine) {
sdl3cpp::logging::TraceGuard trace(__PRETTY_FUNCTION__);;
sdl3cpp::logging::TraceGuard trace;;
lua_pushlightuserdata(L, engine);
lua_pushcclosure(L, &LoadMeshFromFile, 1);
lua_setglobal(L, "load_mesh_from_file");
@@ -41,7 +41,7 @@ void LuaBindings::RegisterBindings(lua_State* L, ScriptEngine* engine) {
}
int LuaBindings::LoadMeshFromFile(lua_State* L) {
sdl3cpp::logging::TraceGuard trace(__PRETTY_FUNCTION__);;
sdl3cpp::logging::TraceGuard trace;;
auto* engine = static_cast<ScriptEngine*>(lua_touserdata(L, lua_upvalueindex(1)));
const char* path = luaL_checkstring(L, 1);
sdl3cpp::logging::Logger::GetInstance().TraceVariable("path", path);
@@ -60,7 +60,7 @@ int LuaBindings::LoadMeshFromFile(lua_State* L) {
}
int LuaBindings::PhysicsCreateBox(lua_State* L) {
sdl3cpp::logging::TraceGuard trace(__PRETTY_FUNCTION__);;
sdl3cpp::logging::TraceGuard trace;;
auto* engine = static_cast<ScriptEngine*>(lua_touserdata(L, lua_upvalueindex(1)));
const char* name = luaL_checkstring(L, 1);
sdl3cpp::logging::Logger::GetInstance().TraceVariable("name", name);