Change important printfs to lg::print (#3355)

This allows them to be logged into a file, useful for debugging.

With this, GOAL `format` and C-kernel `Msg` (and its variants) will be
logged.
This commit is contained in:
ManDude
2024-02-01 18:01:41 +00:00
committed by GitHub
parent b331d16bcc
commit d67b441dac
21 changed files with 124 additions and 80 deletions
+5 -4
View File
@@ -9,6 +9,7 @@
#include "dgo_util.h"
#include "common/link_types.h"
#include "common/log/log.h"
#include "third-party/json.hpp"
@@ -25,9 +26,9 @@ DgoReader::DgoReader(std::string file_name, const std::vector<u8>& data)
if (reader.bytes_left() < obj_header.size && i == header.object_count - 1 &&
obj_header.size - reader.bytes_left() <= 48) {
printf(
"Warning: final file %s in DGO %s has a size missing %d bytes. It will be adjusted from "
"%d to %d bytes.\n",
lg::print(
"Warning: final file {} in DGO {} has a size missing {} bytes. It will be adjusted from "
"{} to {} bytes.\n",
obj_header.name, header.name, obj_header.size - reader.bytes_left(), obj_header.size,
(int)reader.bytes_left());
obj_header.size = reader.bytes_left();
@@ -40,7 +41,7 @@ DgoReader::DgoReader(std::string file_name, const std::vector<u8>& data)
entry.unique_name = get_object_file_name(entry.internal_name, reader.here(), obj_header.size);
if (all_unique_names.find(entry.unique_name) != all_unique_names.end()) {
printf("Warning: there are multiple files named %s\n", entry.unique_name.c_str());
lg::print("Warning: there are multiple files named {}\n", entry.unique_name.c_str());
entry.unique_name += '-';
entry.unique_name += std::to_string(obj_header.size);
}