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:
Tyler Wilding
2022-10-01 11:58:36 -04:00
committed by GitHub
parent 4e48ba21c1
commit 4d751af38e
120 changed files with 990 additions and 893 deletions
+5 -5
View File
@@ -8,11 +8,11 @@
namespace {
void connect_compiler_and_debugger(Compiler& compiler, bool do_break) {
lg::info("connect_compiler_and_debugger:\n");
lg::info("connect_compiler_and_debugger:");
bool connect_status = compiler.connect_to_target();
lg::info("connected: {}\n", connect_status);
lg::info("connected: {}", connect_status);
ASSERT_TRUE(connect_status);
lg::info("poking...\n");
lg::info("poking...");
compiler.poke_target();
for (int i = 0; i < 100; i++) {
if (compiler.get_debugger().is_valid()) {
@@ -25,9 +25,9 @@ void connect_compiler_and_debugger(Compiler& compiler, bool do_break) {
ASSERT_TRUE(compiler.get_debugger().is_valid());
if (do_break) {
lg::info("break...\n");
lg::info("break...");
compiler.run_test_from_string("(dbg)");
lg::info("OK! {} {} {}\n", compiler.get_debugger().is_valid(),
lg::info("OK! {} {} {}", compiler.get_debugger().is_valid(),
compiler.get_debugger().is_attached(), compiler.get_debugger().is_halted());
}
}