[][src]Crate slog_env_cfg

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

env_key

Structs

Config

Holds the configuration parameters. Used to build Drains.

InvalidLogFormat

InvalidLogFormat is an error returned on a LogFormat parse attempt when an invalid logger format name is passed.

Enums

ConfigFromEnvError
LogFormat

Supported log formats.

Constants

ENV_LOGGER_OVERRIDE_DEFAULT_FILTER_DEFAULT

Functions

config_from_env

Build Config using the env vars and opinionated defaults.

drain_from_env

Build slog Drain (more specificly SendSyncRefUnwindSafeDrain) using the config obtained from env. The resulting Drain is ready to be passed to the slog::Logger::root.

logger_from_env

Build slog Logger using the config obtained from env.

Type Definitions

Logger

Logger is a convenience type alias for the slog::Logger. You can use it to pass around the Logger built with this crate in your app code.