Skip to content

Commit 1f3cd2e

Browse files
authored
feat: bak log文件名加个日期 (#14)
1 parent 23a7aab commit 1f3cd2e

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

include/MaaUtils/Logger.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class MAA_UTILS_API Logger
99
{
1010
public:
1111
static constexpr std::string_view kLogFilename = "maa.log";
12-
static constexpr std::string_view kLogbakFilename = "maa.bak.log";
12+
static constexpr std::string_view kLogbakFilename = "maa.bak.{}.log";
1313

1414
public:
1515
static Logger& get_instance();

source/Logger/Logger.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ bool Logger::rotate()
176176

177177
std::error_code ec;
178178

179-
const std::filesystem::path bak_path = log_dir_ / kLogbakFilename;
179+
const std::filesystem::path bak_path = log_dir_ / std::format(kLogbakFilename, format_now_for_filename());
180180
std::filesystem::copy(log_path_, bak_path, std::filesystem::copy_options::overwrite_existing, ec);
181181

182182
return true;

0 commit comments

Comments
 (0)