init_loki_logging

Function init_loki_logging 

Source
pub fn init_loki_logging(config: LokiConfig) -> Result<()>
Expand description

Initializes Loki logging with the provided configuration.

This function sets up the tracing infrastructure to send logs to a Loki server, creating a background task that collects logs and sends them in batches. It configures labels, authentication, and connection details according to the provided configuration. The function integrates with Rust’s tracing ecosystem for seamless log forwarding.

§Parameters

  • config - Configuration settings for the Loki connection and log processing

§Errors

Returns an error if the Loki layer initialization fails, including URL parsing errors, label configuration errors, or connection setup failures