Function lambda_runtime::tracing::init_default_subscriber

source ·
pub fn init_default_subscriber()
Expand description

Initialize tracing-subscriber with default logging options.

This function uses environment variables set with Lambda’s advance logging controls if they’re configured for your function.

This subscriber sets the logging level based on environment variables: - if AWS_LAMBDA_LOG_LEVEL is set, it takes predecence over any other environment variables. - if AWS_LAMBDA_LOG_LEVEL is not set, check if RUST_LOG is set. - if none of those two variables are set, use INFO as the logging level.

The logging format can also be changed based on Lambda’s advanced logging controls. If the AWS_LAMBDA_LOG_FORMAT environment variable is set to JSON, the log lines will be formatted as json objects, otherwise they will be formatted with the default tracing format.