Registry / logging / slog-async

slog-async

JSON →
library2.8.0rscratesunverified

Asynchronous drain for slog-rs that moves logging work off the critical path.

# Cargo.toml [dependencies] slog-async = "2.8.0"
INSTALL
IMPORT
SIG · SLOG-ASYNC
S
slog-async
loggingrustv2.8.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Async
use slog_async::Async;

Creates an asynchronous logger using slog-async.

use slog::{o, Drain}; use slog_async::Async; fn main() { let drain = slog::Discard; let async_drain = Async::new(drain).build().fuse(); let logger = slog::Logger::root(async_drain, o!()); info!(logger, "async logging"); }
Debug
Known issues
gotchaAsync drain requires a running tokio or async-std runtime if used with `Async::new().build().fuse()` in async context.
fix
Ensure an async runtime is active before logging, or use the default `Async::default()` which spawns a dedicated thread.
affects: >=2.0.0
Upgrade
Version history
2.8.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
42 hits · last 30 days
node
36
Amazon
1
Resources
slog-async — cargo add slog-async · libregistry