Registry / logging / slog-envlogger

slog-envlogger

JSON →
library2.2.0rscratesunverified

Port of the standard env_logger to the slog logging framework, allowing environment-variable-based log filtering.

# Cargo.toml [dependencies] slog-envlogger = "2.2.0"
INSTALL
IMPORT
SIG · SLOG-ENVLOGGER
S
slog-envlogger
loggingrustv2.2.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.

EnvLogger
use slog_envlogger::EnvLogger;

Creates a slog logger that filters log records based on the RUST_LOG environment variable.

use slog_envlogger::EnvLogger; use slog::{o, Drain}; fn main() { let decorator = slog_term::TermDecorator::new().build(); let drain = slog_term::FullFormat::new(decorator).build().fuse(); let drain = EnvLogger::new(drain); let logger = slog::Logger::root(drain.fuse(), o!()); info!(logger, "Hello, world!"); }
Debug
Known issues
gotchaRequires slog-term or another drain for output; envlogger alone does not print logs.
fix
Add slog-term and slog to Cargo.toml, and wrap a terminal drain with EnvLogger.
affects: >=2.0.0
Upgrade
Version history
2.2.0latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
43 hits · last 30 days
node
38
Amazon
1
OpenAI (training)
1
Resources
slog-envlogger — cargo add slog-envlogger · libregistry