Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TermLogger: Flush each entry #82

Merged
merged 1 commit into from Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "simplelog"
version = "0.10.1"
version = "0.10.2"
edition = "2018"
authors = ["Drakulix <github@drakulix.de>"]
description = "A simple and easy-to-use logging facility for Rust's log crate"
Expand Down
9 changes: 8 additions & 1 deletion src/loggers/termlog.rs
Expand Up @@ -159,7 +159,14 @@ impl TermLogger {
write_location(record, term_lock)?;
}

write_args(record, term_lock)
write_args(record, term_lock)?;

// The log crate holds the logger as a `static mut`, which isn't dropped
// at program exit: https://doc.rust-lang.org/reference/items/static-items.html
// Sadly, this means we can't rely on the BufferedStandardStreams flushing
// themselves on the way out, so to avoid the Case of the Missing 8k,
// flush each entry.
term_lock.flush()
}

fn try_log(&self, record: &Record<'_>) -> Result<(), Error> {
Expand Down