Function init_default_subscriber

Source
pub fn init_default_subscriber()
Expand description

Initialize tracing-subscriber with default logging options.

The default subscriber writes logs to STDOUT in the current context. If you want to customize the writer, see init_default_subscriber_with_writer().

This function uses environment variables set with Lambda’s advanced 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 precedence 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.