mirror of
https://github.com/open-goal/jak-project
synced 2026-07-07 14:13:45 -04:00
logs: replace every fmt::print with a lg call instead (#1368)
Favors the `lg` namespace over `fmt` directly, as this will output the logs to a file / has log levels. I also made assertion errors go to a file, this unfortunately means importing `lg` and hence `fmt` which was attempted to be avoided before. But I'm not sure how else to do this aspect without re-inventing the file logging. We have a lot of commented out prints as well that we should probably cleanup at some point / switch them to trace level and default to `info` level. I noticed the pattern of disabling debug logs behind some boolean, something to consider cleaning up in the future -- if our logs were more structured (knowing where they are coming from) then a lot this boilerplate could be eliminated. Closes #1358
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "TextureDB.h"
|
||||
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
|
||||
#include "third-party/fmt/core.h"
|
||||
@@ -49,11 +50,11 @@ void TextureDB::replace_textures(const fs::path& path) {
|
||||
for (auto& tex : textures) {
|
||||
fs::path full_path = base_path / tpage_names.at(tex.second.page) / (tex.second.name + ".png");
|
||||
if (fs::exists(full_path)) {
|
||||
fmt::print("Replacing {}\n", full_path.string().c_str());
|
||||
lg::info("Replacing {}", full_path.string().c_str());
|
||||
int w, h;
|
||||
auto data = stbi_load(full_path.string().c_str(), &w, &h, 0, 4); // rgba channels
|
||||
if (!data) {
|
||||
fmt::print("failed to load PNG file: {}\n", full_path.string().c_str());
|
||||
lg::warn("failed to load PNG file: {}", full_path.string().c_str());
|
||||
continue;
|
||||
}
|
||||
tex.second.rgba_bytes.resize(w * h);
|
||||
|
||||
Reference in New Issue
Block a user