Skip to content

Commit

Permalink
fix roll files (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
qicosmos authored Sep 18, 2023
1 parent 059734c commit 9e8d841
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions include/ylt/easylog/appender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,11 @@ class appender {
if (stop_) {
if (queue_.size_approx() > 0) {
while (queue_.try_dequeue(record)) {
if (max_files_ > 0 && file_size_ > max_file_size_ &&
static_cast<size_t>(-1) != file_size_) {
roll_log_files();
}

enable_console_ ? write_record<false, true>(record)
: write_record<false, false>(record);
}
Expand Down Expand Up @@ -304,6 +309,7 @@ class appender {

private:
void open_log_file() {
file_size_ = 0;
std::string filename = build_filename();
file_.open(filename, std::ios::binary | std::ios::out | std::ios::app);
if (file_) {
Expand Down

0 comments on commit 9e8d841

Please sign in to comment.