init

Function init 

Source
pub fn init()
Expand description

Initialize the JSON logger

Behavior controlled by environment variables:

  • RUST_LOG: Log level filtering (e.g., “info”, “debug”, “off”)
  • LOG_FILE_DIR: Directory for log files (e.g., “./logs”)
  • LOG_FILE_PREFIX: Prefix for log files (e.g., “myapp”)
  • LOG_FILE_ONLY: Set to “true” to disable console output
  • LOG_ENABLE_SPANS: Set to “false” to disable #[instrument] span events (default: “true”)

§Examples

// Console only
custom_tracing_logger::init();

// Console + file (with LOG_FILE_DIR=./logs LOG_FILE_PREFIX=myapp)
custom_tracing_logger::init();

// File only (with LOG_FILE_ONLY=true)
custom_tracing_logger::init();

// Disable #[instrument] spans (with LOG_ENABLE_SPANS=false)
custom_tracing_logger::init();