From fdc824b5495c7e98a09a9504f39b74e74b0d6370 Mon Sep 17 00:00:00 2001 From: Quinn Pfeifer <72775766+QuinnP2910@users.noreply.github.com> Date: Mon, 6 Nov 2023 18:03:06 -0800 Subject: [PATCH] Log to file in build directory --- src/Rover.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Rover.cpp b/src/Rover.cpp index 56e6ba76..649c9e20 100644 --- a/src/Rover.cpp +++ b/src/Rover.cpp @@ -115,6 +115,15 @@ void parseCommandLine(int argc, char** argv) { .nargs(0); try { + loguru::init(argc, argv); + + const auto now = std::chrono::system_clock::now(); + const std::time_t t_c = std::chrono::system_clock::to_time_t(now); + std::string logFileName = std::ctime(&t_c); + logFileName += ".log"; + loguru::add_file(logFileName.c_str(), loguru::Append, loguru::g_stderr_verbosity); + LOG_F(INFO, "Logging to %s", logFileName.c_str()); + program.parse_args(argc, argv); LOG_F(INFO, "parseCommandLine got peripheral specified as: \"%s\", logLevel specified as: "