Skip to main content

setup_logger

Function setup_logger 

Source
pub fn setup_logger()
Expand description

Sets up the logger for the application.

The logger level is determined by the DERIBIT_LOG_LEVEL environment variable. If the variable is not set, it defaults to INFO.

This function is safe to call multiple times - it will only initialize the logger once.

ยงExample

use deribit_websocket::utils::setup_logger;

// Set log level via environment variable (unsafe in Rust 2024 edition)
unsafe {
    std::env::set_var("DERIBIT_LOG_LEVEL", "DEBUG");
}

// Initialize the logger
setup_logger();

// Now you can use tracing macros
tracing::info!("Logger initialized");