From 6e2dadc63a7c7e24d98eba956fe6e69e0e66ba6f Mon Sep 17 00:00:00 2001 From: Mark Niebur Date: Wed, 23 Jan 2019 11:35:55 -0700 Subject: [PATCH] Add method to filesinks to return filename --- include/spdlog/sinks/basic_file_sink.h | 5 +++++ include/spdlog/sinks/daily_file_sink.h | 5 +++++ include/spdlog/sinks/rotating_file_sink.h | 5 +++++ 3 files changed, 15 insertions(+) diff --git a/include/spdlog/sinks/basic_file_sink.h b/include/spdlog/sinks/basic_file_sink.h index bc5fb5c3..facc7209 100644 --- a/include/spdlog/sinks/basic_file_sink.h +++ b/include/spdlog/sinks/basic_file_sink.h @@ -30,6 +30,11 @@ public: file_helper_.open(filename, truncate); } + const filename_t &filename() const + { + return file_helper_.filename(); + } + protected: void sink_it_(const details::log_msg &msg) override { diff --git a/include/spdlog/sinks/daily_file_sink.h b/include/spdlog/sinks/daily_file_sink.h index 7bf7c448..08392c16 100644 --- a/include/spdlog/sinks/daily_file_sink.h +++ b/include/spdlog/sinks/daily_file_sink.h @@ -63,6 +63,11 @@ public: rotation_tp_ = next_rotation_tp_(); } + const filename_t &filename() const + { + return file_helper_.filename(); + } + protected: void sink_it_(const details::log_msg &msg) override { diff --git a/include/spdlog/sinks/rotating_file_sink.h b/include/spdlog/sinks/rotating_file_sink.h index a579946f..87784f1b 100644 --- a/include/spdlog/sinks/rotating_file_sink.h +++ b/include/spdlog/sinks/rotating_file_sink.h @@ -58,6 +58,11 @@ public: return fmt::to_string(w); } + const filename_t &filename() const + { + return file_helper_.filename(); + } + protected: void sink_it_(const details::log_msg &msg) override {