Skip to content

Commit

Permalink
refactor: check that the log file was opened successfully
Browse files Browse the repository at this point in the history
  • Loading branch information
Disservin committed Nov 8, 2024
1 parent 91c76ae commit aca242e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions app/src/util/logger/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ void Logger::openFile(const std::string &file) {
}
#endif

// verify that the file was opened

std::visit(
[&](auto &&arg) {
if (!arg.is_open()) {
throw std::runtime_error("Failed to open log file.");
}
},
log_);

Logger::should_log_ = true;
}

Expand Down

0 comments on commit aca242e

Please sign in to comment.