refactor(log): migra core/resources i core/system a Log::

- resource_pack.cpp i resource_cache.cpp: tots els std::cerr passen a
  Log::error.
- director.cpp: std::cout/cerr/fprintf → Log::info / error / critical
  segons severitat.
- printWithDots (utils.cpp): ara és un wrapper sobre Log::info que
  manté l'amplada total (~50 chars) reproduint l'alineació de punts.
  Els callers pasen el tag sense " : " (ja l'afegeix el logger).
- pack_resources: afegit log.cpp i SDL3 al target perquè
  resource_pack.cpp ara depèn de Log::.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
JailDesignerandClaude Opus 4.7 committed 2026-05-08 09:10:03 +02:00
1 parent 1243b457be
commit 6e99fd0a8b
8 files changed
+51 -44

No files matched your search

+13 -9
View File
@@ -1,18 +1,22 @@
#include "utils/utils.hpp"
#include <filesystem>
#include <ios>
#include <iostream>
#include <string>
#include "utils/log.hpp"
auto getFileName(const std::string& path) -> std::string {
return std::filesystem::path(path).filename().string();
}
void printWithDots(const std::string& text1, const std::string& text2, const std::string& text3) {
std::cout.setf(std::ios::left, std::ios::adjustfield);
std::cout << text1;
std::cout.width(50 - text1.length() - text3.length());
std::cout.fill('.');
std::cout << text2;
std::cout << text3 << '\n';
void printWithDots(const std::string& tag, const std::string& filename, const std::string& status) {
// Reprodueix l'alineació històrica (amplada total ≈ 50). El logger anteposa
// automàticament "tag: ", per això aquí només componem el cos.
constexpr std::size_t TOTAL_WIDTH = 50;
const std::size_t PREFIX_LEN = tag.size() + 2; // "{tag}: "
const std::size_t USED = PREFIX_LEN + status.size();
const std::size_t FIELD = (USED < TOTAL_WIDTH) ? (TOTAL_WIDTH - USED) : 0;
std::string body = filename;
if (body.size() < FIELD) { body.resize(FIELD, '.'); }
Log::info(tag, "{}{}", body, status);
}