eliminat molt de ruido de la consola de log

This commit is contained in:
2026-04-14 13:04:24 +02:00
parent f5da35bfb2
commit cf7ea6cc9c
27 changed files with 144 additions and 383 deletions

View File

@@ -2,11 +2,11 @@
#include <SDL3/SDL.h> // Para SDL_IOStream, SDL_IOFromConstMem, SDL_IOFromFile, SDL_ReadIO, SDL_WriteIO, SDL_CloseIO
#include <iostream> // Para std::cout
#include <stdexcept> // Para runtime_error
#include "resource_helper.hpp" // Para ResourceHelper
#include "ui/logger.hpp"
#include "utils.hpp" // Para printWithDots, getFileName
#include "utils.hpp" // Para getFileName
// Carga el fichero de datos para la demo
auto loadDemoDataFromFile(const std::string& file_path) -> DemoData {
@@ -24,10 +24,9 @@ auto loadDemoDataFromFile(const std::string& file_path) -> DemoData {
}
if (file == nullptr) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: Fichero no encontrado %s", file_path.c_str());
std::cout << "Error: Fichero no encontrado " << file_path << '\n';
throw std::runtime_error("Fichero no encontrado: " + file_path);
}
Logger::dots("DemoData : ", getFileName(file_path), "[ LOADED ]");
// Lee todos los datos del fichero y los deja en el destino
for (int i = 0; i < TOTAL_DEMO_DATA; ++i) {
@@ -52,18 +51,15 @@ bool saveDemoFile(const std::string& file_path, const DemoData& dd) {
// Guarda los datos
for (const auto& data : dd) {
if (SDL_WriteIO(file, &data, sizeof(DemoKeys)) != sizeof(DemoKeys)) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error al escribir el fichero %s", getFileName(file_path).c_str());
std::cout << "Error al escribir el fichero " << getFileName(file_path) << '\n';
success = false;
break;
}
}
if (success) {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Writing file %s", getFileName(file_path).c_str());
}
// Cierra el fichero
SDL_CloseIO(file);
} else {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Error: Unable to save %s file! %s", getFileName(file_path).c_str(), SDL_GetError());
std::cout << "Error: Unable to save " << getFileName(file_path) << " file! " << SDL_GetError() << '\n';
success = false;
}