Commit 4b4b782d authored by Dominik Charousset's avatar Dominik Charousset

Print nothing if no user events occur

parent a89e0b38
...@@ -547,16 +547,24 @@ string_view logger::skip_path(string_view path) { ...@@ -547,16 +547,24 @@ string_view logger::skip_path(string_view path) {
} }
void logger::run() { void logger::run() {
// Bail out without printing anything if the first event we receive is the
// shutdown (empty) event.
queue_.wait_nonempty();
if (queue_.front().message.empty())
return;
log_first_line(); log_first_line();
// Loop until receiving an empty message.
for (;;) { for (;;) {
queue_.wait_nonempty(); // Handle current head of the queue.
auto& e = queue_.front(); auto& e = queue_.front();
if (e.message.empty()) { if (e.message.empty()) {
log_last_line(); log_last_line();
return; return;
} }
handle_event(e); handle_event(e);
// Prepare next iteration.
queue_.pop_front(); queue_.pop_front();
queue_.wait_nonempty();
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment