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
Drain
s. - Invalid
LogFormat InvalidLogFormat
is an error returned on aLogFormat
parse attempt when an invalid logger format name is passed.
Enums§
- Config
From EnvError - LogFormat
- Supported log formats.
Constants§
Functions§
- config_
from_ env - Build
Config
using the env vars and opinionated defaults. - drain_
from_ env - Build slog
Drain
(more specificlySendSyncRefUnwindSafeDrain
) using the config obtained from env. The resultingDrain
is ready to be passed to theslog::Logger::root
. - logger_
from_ env - Build slog
Logger
using the config obtained from env.
Type Aliases§
- Logger
Logger
is a convenience type alias for theslog::Logger
. You can use it to pass around theLogger
built with this crate in your app code.