|
| 1 | +commit 2d6bc609769eaa4a70a6dd384351f54c6633f3a9 |
| 2 | +Author: dentiny < [email protected]> |
| 3 | +Date: Thu Dec 19 17:17:56 2024 +0000 |
| 4 | + |
| 5 | + patch spdlog rotation filename |
| 6 | + |
| 7 | + Signed-off-by: dentiny < [email protected]> |
| 8 | + |
| 9 | +diff --git a/include/spdlog/sinks/rotating_file_sink-inl.h b/include/spdlog/sinks/rotating_file_sink-inl.h |
| 10 | +index cf8b9d5c..7580c06f 100644 |
| 11 | +--- a/include/spdlog/sinks/rotating_file_sink-inl.h |
| 12 | ++++ b/include/spdlog/sinks/rotating_file_sink-inl.h |
| 13 | +@@ -50,7 +50,7 @@ SPDLOG_INLINE rotating_file_sink<Mutex>::rotating_file_sink( |
| 14 | + } |
| 15 | + |
| 16 | + // calc filename according to index and file extension if exists. |
| 17 | +-// e.g. calc_filename("logs/mylog.txt, 3) => "logs/mylog.3.txt". |
| 18 | ++// e.g. calc_filename("logs/mylog.txt, 3) => "logs/mylog.txt.3". |
| 19 | + template<typename Mutex> |
| 20 | + SPDLOG_INLINE filename_t rotating_file_sink<Mutex>::calc_filename(const filename_t &filename, std::size_t index) |
| 21 | + { |
| 22 | +@@ -58,10 +58,7 @@ SPDLOG_INLINE filename_t rotating_file_sink<Mutex>::calc_filename(const filename |
| 23 | + { |
| 24 | + return filename; |
| 25 | + } |
| 26 | +- |
| 27 | +- filename_t basename, ext; |
| 28 | +- std::tie(basename, ext) = details::file_helper::split_by_extension(filename); |
| 29 | +- return fmt_lib::format(SPDLOG_FILENAME_T("{}.{}{}"), basename, index, ext); |
| 30 | ++ return fmt_lib::format(SPDLOG_FILENAME_T("{}.{}"), filename, index); |
| 31 | + } |
| 32 | + |
| 33 | + template<typename Mutex> |
0 commit comments