refactor(log): migra core/input i core/audio a Log::
- gamepad_manager.cpp (12 logs): connect/disconnect com a info, errors d'open/init com a error, warning per BD no carregada. - key_config.cpp (5 logs): error per arxius malformats, info per al recompte de bindings carregats. - gamepad_bindings.cpp (4 logs): error/info anàleg. - audio_effects.cpp (2 errors de format). - sound_effects_config.cpp (3 logs): warn quan no hi ha presets, error de parse. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6e99fd0a8b
commit
0b708f1515
5 files changed
+30
-41
No files matched your search
@@ -3,12 +3,12 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include "external/fkyaml_node.hpp"
|
||||
#include "utils/log.hpp"
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -167,8 +167,7 @@ void GamepadBindings::load(const std::string& file_path) {
|
||||
try {
|
||||
auto yaml = fkyaml::node::deserialize(CONTENT);
|
||||
if (!yaml.contains("gamepads") || !yaml["gamepads"].is_sequence()) {
|
||||
std::cerr << "GamepadBindings: secció 'gamepads' absent o invàlida a "
|
||||
<< file_path << '\n';
|
||||
Log::error("GamepadBindings", "secció 'gamepads' absent o invàlida a {}", file_path);
|
||||
return;
|
||||
}
|
||||
for (const auto& entry : yaml["gamepads"]) {
|
||||
@@ -188,11 +187,9 @@ void GamepadBindings::load(const std::string& file_path) {
|
||||
}
|
||||
configs_.push_back(std::move(cfg));
|
||||
}
|
||||
std::cout << "GamepadBindings: " << configs_.size() << " mandos carregats de "
|
||||
<< file_path << '\n';
|
||||
Log::info("GamepadBindings", "{} mandos carregats de {}", configs_.size(), file_path);
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "GamepadBindings: error parsejant " << file_path << ": "
|
||||
<< e.what() << '\n';
|
||||
Log::error("GamepadBindings", "error parsejant {}: {}", file_path, e.what());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +212,7 @@ auto GamepadBindings::save() -> bool {
|
||||
|
||||
std::ofstream file(file_path_, std::ios::binary);
|
||||
if (!file) {
|
||||
std::cerr << "GamepadBindings: no es pot escriure " << file_path_ << '\n';
|
||||
Log::error("GamepadBindings", "no es pot escriure {}", file_path_);
|
||||
return false;
|
||||
}
|
||||
file << out.str();
|
||||
|
||||
Reference in new issue
Block a user