Skip to content

Commit

Permalink
Log to file in build directory
Browse files Browse the repository at this point in the history
  • Loading branch information
quinnmp committed Nov 7, 2023
1 parent ab1ee06 commit fdc824b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Rover.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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: "
Expand Down

0 comments on commit fdc824b

Please sign in to comment.