Skip to main content

init_logger

Function init_logger 

Source
pub fn init_logger(
    callback: Option<Arc<dyn LogCallback>>,
    level: Option<LogLevel>,
)
Expand description

Initialize the SDK logger

This function should be called once before creating any SDK clients. It initializes the tracing infrastructure for the SDK and optionally registers a callback to receive log events.

§Parameters

  • callback: Optional callback to receive SDK log events. Pass None to use only platform loggers (oslog on iOS, logcat on Android).
  • level: Optional log level. Defaults to Info if not specified. Can be overridden by RUST_LOG environment variable at runtime or compile time.

§Example

// Initialize with callback and trace-level logging before creating clients
initLogger(FlightRecorderCallback(), LogLevel.TRACE)
val client = Client(tokenProvider, settings)

§Notes

  • This function can only be called once - subsequent calls are ignored
  • If not called explicitly, logging is auto-initialized when first client is created
  • Platform loggers (oslog/logcat) are always enabled regardless of callback