mirror of
https://github.com/open-goal/jak-project
synced 2026-09-07 19:40:48 -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:
@@ -3,6 +3,7 @@
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
|
||||
#include "common/log/log.h"
|
||||
#include "common/util/Assert.h"
|
||||
#include "common/util/print_float.h"
|
||||
|
||||
@@ -414,15 +415,15 @@ VuProgram VuDisassembler::disassemble(void* data, int size_bytes, bool debug_pri
|
||||
|
||||
// debug
|
||||
if (debug_print) {
|
||||
fmt::print("{}\n", to_string(VuInstructionPair{upper_instr, lower_instr}));
|
||||
lg::print("{}\n", to_string(VuInstructionPair{upper_instr, lower_instr}));
|
||||
}
|
||||
}
|
||||
|
||||
name_labels();
|
||||
|
||||
if (debug_print) {
|
||||
fmt::print("----------------------------------\n");
|
||||
fmt::print("{}\n", to_string(prog));
|
||||
lg::print("----------------------------------\n");
|
||||
lg::print("{}\n", to_string(prog));
|
||||
}
|
||||
|
||||
return prog;
|
||||
@@ -1014,7 +1015,7 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma
|
||||
instr.src.at(1).to_string(m_label_names));
|
||||
default:
|
||||
unk++;
|
||||
fmt::print("unknown 0 is {}\n", to_string(instr));
|
||||
lg::print("unknown 0 is {}\n", to_string(instr));
|
||||
|
||||
return "ASSERT(false);"; //"???";
|
||||
}
|
||||
@@ -1022,7 +1023,7 @@ std::string VuDisassembler::to_cpp(const VuInstruction& instr, bool mips2c_forma
|
||||
unknown:
|
||||
|
||||
unk++;
|
||||
fmt::print("unknown 1 is {}\n", to_string(instr));
|
||||
lg::print("unknown 1 is {}\n", to_string(instr));
|
||||
|
||||
return "ASSERT(false);";
|
||||
}
|
||||
@@ -1262,7 +1263,7 @@ std::string VuDisassembler::to_string_with_cpp(const VuProgram& prog, bool mips2
|
||||
}
|
||||
}
|
||||
}
|
||||
fmt::print("TOTAL unk: {}\n", unk);
|
||||
lg::print("TOTAL unk: {}\n", unk);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user