util/file: cleanup log initialization and some file-util functions (#2299)

Fixes both issues mentioned in #2297
This commit is contained in:
Tyler Wilding
2023-03-01 17:52:33 -05:00
committed by GitHub
parent 43da4088e6
commit bc40fc5d2f
9 changed files with 76 additions and 32 deletions
+8 -2
View File
@@ -16,7 +16,7 @@
#include "third-party/fmt/core.h"
void setup_logging() {
lg::set_file(file_util::get_file_path({"log/compiler.txt"}));
lg::set_file(file_util::get_file_path({"log", "compiler.log"}));
lg::set_file_level(lg::level::info);
lg::set_stdout_level(lg::level::info);
lg::set_flush_level(lg::level::info);
@@ -79,7 +79,13 @@ int main(int argc, char** argv) {
return 1;
}
setup_logging();
try {
setup_logging();
} catch (const std::exception& e) {
lg::error("Failed to setup logging: {}", e.what());
return 1;
}
lg::info("OpenGOAL Compiler {}.{}", versions::GOAL_VERSION_MAJOR, versions::GOAL_VERSION_MINOR);
// Figure out the username