Skip to content

Commit

Permalink
Add method to filesinks to return filename
Browse files Browse the repository at this point in the history
  • Loading branch information
Mark Niebur committed Jan 23, 2019
1 parent 00e89a2 commit 6e2dadc
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions include/spdlog/sinks/basic_file_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ class basic_file_sink final : public base_sink<Mutex>
file_helper_.open(filename, truncate);
}

const filename_t &filename() const
{
return file_helper_.filename();
}

protected:
void sink_it_(const details::log_msg &msg) override
{
Expand Down
5 changes: 5 additions & 0 deletions include/spdlog/sinks/daily_file_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ class daily_file_sink final : public base_sink<Mutex>
rotation_tp_ = next_rotation_tp_();
}

const filename_t &filename() const
{
return file_helper_.filename();
}

protected:
void sink_it_(const details::log_msg &msg) override
{
Expand Down
5 changes: 5 additions & 0 deletions include/spdlog/sinks/rotating_file_sink.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class rotating_file_sink final : public base_sink<Mutex>
return fmt::to_string(w);
}

const filename_t &filename() const
{
return file_helper_.filename();
}

protected:
void sink_it_(const details::log_msg &msg) override
{
Expand Down

0 comments on commit 6e2dadc

Please sign in to comment.