Skip to content

Commit

Permalink
fix(logger): handle empty log messages (partial fix for gh #241)
Browse files Browse the repository at this point in the history
  • Loading branch information
mhx committed Nov 20, 2024
1 parent ccbb3e1 commit 004a90d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,12 @@ void stream_logger::write(level_type level, const std::string& output,
split_to(output, '\n', lines);
}

if (lines.back().empty()) {
lines.pop_back();
if (!lines.empty()) {
if (lines.back().empty()) {
lines.pop_back();
}
} else {
lines.push_back("<<< no log message >>>");
}

std::ostringstream oss;
Expand Down

0 comments on commit 004a90d

Please sign in to comment.