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 {