Agora
1.2.0
Agora project
|
Go to the documentation of this file.
6 #ifndef SPDLOG_HEADER_ONLY
26 template<
typename Mutex>
29 : base_filename_(
std::move(base_filename))
31 , max_files_(max_files)
32 , file_helper_{event_handlers}
36 throw_spdlog_ex(
"rotating sink constructor: max_size arg cannot be zero");
39 if (max_files > 200000)
41 throw_spdlog_ex(
"rotating sink constructor: max_files arg cannot exceed 200000");
43 file_helper_.open(calc_filename(base_filename_, 0));
44 current_size_ = file_helper_.size();
45 if (rotate_on_open && current_size_ > 0)
54 template<
typename Mutex>
67 template<
typename Mutex>
71 return file_helper_.filename();
74 template<
typename Mutex>
79 auto new_size = current_size_ + formatted.
size();
84 if (new_size > max_size_)
87 if (file_helper_.size() > 0)
90 new_size = formatted.
size();
93 file_helper_.write(formatted);
94 current_size_ = new_size;
97 template<
typename Mutex>
100 file_helper_.flush();
108 template<
typename Mutex>
114 file_helper_.close();
115 for (
auto i = max_files_;
i > 0; --
i)
117 filename_t src = calc_filename(base_filename_,
i - 1);
124 if (!rename_file_(src,
target))
130 if (!rename_file_(src,
target))
132 file_helper_.reopen(
true);
138 file_helper_.reopen(
true);
143 template<
typename Mutex>
target
Definition: mm_gui.py:125
SPDLOG_INLINE int rename(const filename_t &filename1, const filename_t &filename2) SPDLOG_NOEXCEPT
Definition: os-inl.h:177
static std::tuple< filename_t, filename_t > split_by_extension(const filename_t &fname)
Definition: file_helper-inl.h:149
SPDLOG_INLINE void sleep_for_millis(unsigned int milliseconds) SPDLOG_NOEXCEPT
Definition: os-inl.h:376
bool rename_file_(const filename_t &src_filename, const filename_t &target_filename)
Definition: rotating_file_sink-inl.h:144
filename_t filename()
Definition: rotating_file_sink-inl.h:68
SPDLOG_INLINE bool path_exists(const filename_t &filename) SPDLOG_NOEXCEPT
Definition: os-inl.h:187
constexpr auto size() const -> size_t
Definition: core.h:820
rotating_file_sink(filename_t base_filename, std::size_t max_size, std::size_t max_files, bool rotate_on_open=false, const file_event_handlers &event_handlers={})
Definition: rotating_file_sink-inl.h:27
index
Definition: parse_all_dl.m:11
filename
Definition: parse_all_dl.m:14
SPDLOG_INLINE void throw_spdlog_ex(const std::string &msg, int last_errno)
Definition: common-inl.h:72
static filename_t calc_filename(const filename_t &filename, std::size_t index)
Definition: rotating_file_sink-inl.h:55
Definition: base_sink.h:19
for i
Definition: generate_data.m:107
SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)
Definition: os-inl.h:398
j template void())
Definition: json.hpp:4744
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
void flush_() override
Definition: rotating_file_sink-inl.h:98
#define SPDLOG_INLINE
Definition: common.h:42
#define SPDLOG_FILENAME_T(s)
Definition: common.h:123
void rotate_()
Definition: rotating_file_sink-inl.h:109
Definition: json.hpp:5213
SPDLOG_INLINE int remove(const filename_t &filename) SPDLOG_NOEXCEPT
Definition: os-inl.h:163
void sink_it_(const details::log_msg &msg) override
Definition: rotating_file_sink-inl.h:75
std::string filename_t
Definition: common.h:122
std::string format(const T &value)
Definition: utils.h:15