[][src]Crate slog_env_cfg

Example

// Read the configuration from environment and build slog drain.
let drain = slog_env_cfg::drain_from_env()?;
// Use the darin to create a logger as usual.
let root = slog::Logger::root(drain, o!());
// Log something!
info!(root, "formatted: {}", 1; "log-key" => true);

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

LogFormat

Supported log formats.

LogFormatFromEnvError

LogFormatFromEnvError captures all possible errors that can occur when log format is constructred from the system environment variables.

LogFormatFromEnvWithDefaultError

LogFormatFromEnvWithDefaultError captures all possible errors that can occur when log format is constructred from the system environment variables with error cases handled by default assignment logic excluded.

Constants

STANDARD_LOG_FORMAT_ENV_KEY

Traits

Drain

Logging drain

Functions

config_from_env

Build Config using the STANDARD_LOG_FORMAT_ENV_KEY env var.

drain_from_env

Build slog Drain using the STANDARD_LOG_FORMAT_ENV_KEY env var.

log_format_from_env

Build LogFormat from env vars.

log_format_from_env_with_default

Build LogFormat from env, or return default if the env value is not set.

Type Definitions

Logger