Skip to main content

init_logger

Function init_logger 

Source
pub fn init_logger(
    db_path: &Path,
    log_level: LogLevel,
    quiet: bool,
) -> Result<LoggerInitResult>
Expand description

Initialize the logger with file rotation and optional console output.

§Arguments

  • db_path - Path to the database directory (logs stored in db_path/logs/)
  • log_level - Log level to use
  • quiet - If true, suppress console output (log only to file)

§Returns

Returns LoggerInitResult indicating whether file logging is active:

  • FileLogging: File logging successfully initialized
  • ConsoleOnly: Subscriber already set, fallback to console-only

Uses try_init() so it won’t panic if a subscriber is already set (e.g. early console-only subscriber from main.rs).