Skip to content

Commit b549c49

Browse files
authored
[core] Add spdlog for rotation filename format (ray-project#49365)
Signed-off-by: dentiny <[email protected]>
1 parent 3312fcb commit b549c49

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

bazel/ray_deps_setup.bzl

+5
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ def ray_deps_setup():
131131
build_file = "@com_github_ray_project_ray//bazel:BUILD.spdlog",
132132
urls = ["https://github.com/gabime/spdlog/archive/v1.12.0.zip"],
133133
sha256 = "6174bf8885287422a6c6a0312eb8a30e8d22bcfcee7c48a6d02d1835d7769232",
134+
# spdlog rotation filename format conflict with ray, update the format.
135+
patches = [
136+
"@com_github_ray_project_ray//thirdparty/patches:spdlog-rotation-file-format.patch",
137+
],
138+
patch_args = ["-p1"],
134139
)
135140

136141
auto_http_archive(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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

Comments
 (0)