log: ensure the log/ directory exists (#2904)

This commit is contained in:
Tyler Wilding 2023-08-14 20:19:10 -06:00 committed by GitHub
parent a0da98a367
commit 2c669b7f5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -128,6 +128,7 @@ void set_file(const std::string& filename,
} else { } else {
file_path = file_util::get_file_path({"log", filename}); file_path = file_util::get_file_path({"log", filename});
} }
file_util::create_dir_if_needed_for_file(file_path);
std::string complete_filename = file_path; std::string complete_filename = file_path;
if (should_rotate) { if (should_rotate) {
complete_filename += "." + str_util::current_local_timestamp_no_colons() + ".log"; complete_filename += "." + str_util::current_local_timestamp_no_colons() + ".log";