Skip to content

Commit

Permalink
alog tail append after formated, so add a newline is neccessary
Browse files Browse the repository at this point in the history
  • Loading branch information
Coldwings committed Jul 18, 2024
1 parent ac06081 commit e2849c9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/alog.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,15 +621,15 @@ struct __limit_first_n {
uint64_t count = 0;
bool operator()() { return (++count) > N; }
void reset() { count = 0; }
void append_tail(LogBuffer& buffer) { buffer << " <" << count << " log(s)>"; }
void append_tail(LogBuffer& buffer) { buffer << " <" << count << " log(s)>\n"; }
};

template <uint64_t N>
struct __limit_every_n {
uint64_t count = 0;
bool operator()() { return ((++count) % N) != 1; }
void reset() { count = 0; }
void append_tail(LogBuffer& buffer) { buffer << " <" << count << " log(s)>"; }
void append_tail(LogBuffer& buffer) { buffer << " <" << count << " log(s)>\n"; }
};

template <time_t T>
Expand All @@ -649,7 +649,7 @@ struct __limit_every_t {
void reset() { last = 0; }
void append_tail(LogBuffer& buffer) {
if (duration)
buffer << " <last log " << duration << " sec>";
buffer << " <last log " << duration << " sec>\n";
duration = 0;
}
};
Expand All @@ -672,7 +672,7 @@ struct __limit_first_n_every_t {
}
void append_tail(STFMTLogBuffer& buffer) {
if (cnt) {
buffer << " <" << cnt << " log(s) in " << T << " sec>";
buffer << " <" << cnt << " log(s) in " << T << " sec>\n";
cnt = 0;
}
}
Expand Down

0 comments on commit e2849c9

Please sign in to comment.