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

@@ -36,7 +36,6 @@
#include "sections/title.hpp" // Para Title
#include "shutdown.hpp" // Para resultToString, shutdownSystem, ShutdownResult
#include "system_utils.hpp" // Para createApplicationFolder, resultToString, Result
#include "ui/logger.hpp" // Para section, put
#include "ui/notifier.hpp" // Para Notifier
#include "ui/service_menu.hpp" // Para ServiceMenu
#include "utils.hpp" // Para Overrides, overrides
@@ -49,11 +48,11 @@ Director::Director(int argc, std::span<char*> argv) {
SDL_SetLogPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
SDL_SetLogPriority(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR);
Logger::put("Game start\n");
// Inicia la semilla aleatoria usando el tiempo actual en segundos
std::srand(static_cast<unsigned int>(std::time(nullptr)));
std::cout << "Game start\n";
// Comprueba los parametros del programa
checkProgramArguments(argc, argv);
@@ -80,7 +79,6 @@ Director::~Director() {
// que close() destruye a continuación.
resetActiveSection();
close();
Logger::put("\nBye!");
}
// Inicializa todo
@@ -106,10 +104,8 @@ void Director::init() {
loadAssets(); // Crea el índice de archivos
Logger::section("INIT INPUT");
Input::init(Asset::get()->getPath("gamecontrollerdb.txt"), Asset::get()->getPath("controllers.json")); // Carga configuración de controles
Logger::section("INIT CONFIG");
Options::setConfigFile(Asset::get()->getPath("config.yaml")); // Establece el fichero de configuración
Options::setControllersFile(Asset::get()->getPath("controllers.json")); // Establece el fichero de configuración de mandos
Options::setPostFXFile(Asset::get()->getPath("postfx.yaml")); // Establece el fichero de presets PostFX
@@ -123,13 +119,10 @@ void Director::init() {
// Inicialización de subsistemas principales
Lang::setLanguage(Options::settings.language); // Carga el archivo de idioma
Logger::section("INIT VIDEO");
Screen::init(); // Inicializa la pantalla y el sistema de renderizado
Logger::section("INIT AUDIO");
Audio::init(); // Activa el sistema de audio
Logger::section("INIT RESOURCES");
#ifdef _DEBUG
Resource::init(debug_config.resource_loading == "lazy" ? Resource::LoadingMode::LAZY_LOAD : Resource::LoadingMode::PRELOAD);
#else
@@ -138,8 +131,6 @@ void Director::init() {
ServiceMenu::init(); // Inicializa el menú de servicio
Notifier::init(std::string(), Resource::get()->getText("8bithud")); // Inicialización del sistema de notificaciones
Screen::get()->getSingletons(); // Obtiene los punteros al resto de singletones
Logger::section("GAME LOG");
}
// Cierra todo y libera recursos del sistema y de los singletons
@@ -156,6 +147,8 @@ void Director::close() {
Screen::destroy(); // Libera el sistema de pantalla y renderizado
Asset::destroy(); // Libera el gestor de archivos
std::cout << "\nBye!\n";
// Libera todos los recursos de SDL
SDL_Quit();
@@ -200,8 +193,6 @@ void Director::loadAssets() {
std::string config_path = executable_path_ + PREFIX + "/config/assets.txt";
Asset::get()->loadFromFile(config_path, PREFIX, system_folder_);
Logger::put("Assets configuration loaded successfully");
// Si falta algun fichero, sale del programa
if (!Asset::get()->check()) {
throw std::runtime_error("Falta algun fichero");
@@ -255,7 +246,6 @@ void Director::loadDebugConfig() {
out << "show_render_info: true\n";
out << "resource_loading: preload\n";
out.close();
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Debug config created: %s", DEBUG_FILE.c_str());
}
// Usar defaults de DebugConfig
} else {
@@ -288,9 +278,8 @@ void Director::loadDebugConfig() {
debug_config.resource_loading = yaml["resource_loading"].get_value<std::string>();
} catch (...) {}
}
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Debug config loaded: section=%s options=%s stage=%d", debug_config.initial_section.c_str(), debug_config.initial_options.c_str(), debug_config.initial_stage);
} catch (...) {
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "Error parsing debug.yaml, using defaults");
std::cout << "Error parsing debug.yaml, using defaults" << '\n';
}
}