Expand description
Example
// Read the configuration from environment and build a logger.
let root = slog_env_cfg::logger_from_env(o!())?;
// Log something!
info!(root, "formatted: {}", 1; "log-key" => true);Modules§
Structs§
- Config
- Holds the configuration parameters.
Used to build
Drains. - Invalid
LogFormat InvalidLogFormatis an error returned on aLogFormatparse attempt when an invalid logger format name is passed.
Enums§
- Config
From EnvError - LogFormat
- Supported log formats.
Constants§
Functions§
- config_
from_ env - Build
Configusing the env vars and opinionated defaults. - drain_
from_ env - Build slog
Drain(more specificlySendSyncRefUnwindSafeDrain) using the config obtained from env. The resultingDrainis ready to be passed to theslog::Logger::root. - logger_
from_ env - Build slog
Loggerusing the config obtained from env.
Type Aliases§
- Logger
Loggeris a convenience type alias for theslog::Logger. You can use it to pass around theLoggerbuilt with this crate in your app code.