Skip to content

Commit 954af5d

Browse files
committed
Remove slog-async dependency
According to the slog-term docs: > PlainSync Decorator implementation > > This implementation is exactly like PlainDecorator but it takes > care of synchronizing writes to io. Since we care about colouring, wrap a slog_term::TermDecorator in a std::sync::Mutex so that coloured output is still maintained. This ensures that log messages will not be dropped when the logging rate exceeds the backend's ability to drain (as the previous slog-async backend could do). Previously when this occurred, the log output would show the following: slog-async: logger dropped messages due to channel overflow An alternative might be to keep the slog-async dependency but use slog_async::OverflowStrategy::Block to ensure that overflowing writes will block, rather than forcing each write through the mutex. Fixes #131
1 parent 425cb17 commit 954af5d

File tree

3 files changed

+2
-36
lines changed

3 files changed

+2
-36
lines changed

Cargo.lock

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ clap_complete = "4"
3131
clap_complete_nushell = "4"
3232
slog = "2.5"
3333
slog-term = "2.6"
34-
slog-async = "2.5"
3534
memchr = "2.3"
3635
anyhow = "1.0"
3736

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ fn main() {
6666

6767
let decorator = slog_term::TermDecorator::new().build();
6868
let drain = slog_term::FullFormat::new(decorator).build().fuse();
69-
let drain = slog_async::Async::new(drain).build().fuse();
69+
let drain = std::sync::Mutex::new(drain).fuse();
70+
7071
let drain = slog::LevelFilter::new(
7172
drain,
7273
if verbose {

0 commit comments

Comments
 (0)