From 2fc1163bbfa26fa8bedee40e7ceb7e84b4f138d8 Mon Sep 17 00:00:00 2001 From: MistEO Date: Mon, 29 May 2023 17:07:43 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E6=97=A5=E5=BF=97=E5=8A=A0?= =?UTF-8?q?=E5=85=A5=E7=AE=80=E5=8D=95=E7=9A=84rotate?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/MaaCore/Utils/Logger.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/MaaCore/Utils/Logger.hpp b/src/MaaCore/Utils/Logger.hpp index 2c12831460..658209515b 100644 --- a/src/MaaCore/Utils/Logger.hpp +++ b/src/MaaCore/Utils/Logger.hpp @@ -420,6 +420,7 @@ namespace asst if (m_ofs.is_open()) { m_ofs.close(); } + rotate(); } private: @@ -428,11 +429,11 @@ namespace asst Logger() : m_directory(UserDir.get()) { std::filesystem::create_directories(m_log_path.parent_path()); - check_filesize_and_remove(); + rotate(); log_init_info(); } - void check_filesize_and_remove() const + void rotate() const { constexpr uintmax_t MaxLogSize = 4ULL * 1024 * 1024; try {