- 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>
23 lines
855 B
C++
23 lines
855 B
C++
#include "utils/utils.hpp"
|
|
|
|
#include <filesystem>
|
|
#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& 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);
|
|
}
|