[][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);

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

SendSyncRefUnwindSafeDrain

Drain + Send + Sync + RefUnwindSafe bound

Functions

config_from_env

Build Config using the STANDARD_LOG_FORMAT_ENV_KEY env var.

drain_from_env

Build slog Drain (more specificly SendSyncRefUnwindSafeDrain) 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.

logger_from_env

Build slog Logger using the STANDARD_LOG_FORMAT_ENV_KEY env var.

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.