Patch - Adds macro for simplified logging - V14.5.28
Introduces a macro to streamline logging, enhancing code readability and maintainability. The new macro replaces direct Logger calls with more concise and expressive `LOG_INFO`, `LOG_ERROR` etc. calls, reducing boilerplate code and improving consistency in logging practices across the engine.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#include <imgui.h>
|
||||
#include "entity.h"
|
||||
|
||||
#include "Logger.h"
|
||||
#include "macro.h"
|
||||
|
||||
/**
|
||||
* namespace for the Entity-Component-System (ECS)
|
||||
|
||||
@@ -80,13 +80,13 @@ public:
|
||||
if (!m_system) return false;
|
||||
}
|
||||
|
||||
Logger::Get().Log("Loading audio file: " + path, __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||
LOG_INFO("Loading audio file: " + path);
|
||||
|
||||
m_soundPath = path;
|
||||
|
||||
if (!std::filesystem::exists(path)) {
|
||||
m_lastError = "Fichier non trouv<75>: " + path;
|
||||
Logger::Get().Log(m_lastError, __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||
LOG_ERROR(m_lastError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -109,6 +109,7 @@ public:
|
||||
if (result != FMOD_OK) {
|
||||
m_lastError = "<EFBFBD>chec du chargement du son: " + std::to_string(result) +
|
||||
" (chemin: " + absolutePath.string() + ")";
|
||||
LOG_ERROR(m_lastError);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -297,6 +298,7 @@ public:
|
||||
|
||||
if (!m_lastError.empty()) {
|
||||
ImGui::TextColored(ImVec4(1, 0, 0, 1), "Error: %s", m_lastError.c_str());
|
||||
LOG_ERROR(m_lastError);
|
||||
}
|
||||
} else {
|
||||
ImGui::Text("Loaded: %s", m_soundPath.c_str());
|
||||
@@ -507,8 +509,6 @@ public:
|
||||
std::getline(ss, s_priority, ':');
|
||||
std::getline(ss, s_spatialized, ':');
|
||||
std::getline(ss, s_use_velocity, ':');
|
||||
|
||||
Logger::Get().Log("Deserializing AudioComponent: path=" + m_soundPath, __FILE__, __LINE__, Logger::LogLevel::Warning);
|
||||
|
||||
m_volume = std::stof(s_volume);
|
||||
m_pan = std::stof(s_pan);
|
||||
|
||||
@@ -284,7 +284,7 @@ public:
|
||||
|
||||
if (!token.empty()) {
|
||||
paths.emplace_back(token.begin(), token.end());
|
||||
Logger::Get().Log("Loaded path: " + std::string(token.begin(), token.end()), __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||
LOG_INFO("Loaded path: " + std::string(token.begin(), token.end()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user