Skip to main content

Module logging

Module logging 

Source
Expand description

Logging module for netoptim-rs.

This module provides optional logging capabilities via env_logger. It is only available when the std feature is enabled.

§Usage

use netoptim_rs::logging::init_logger;

init_logger();
log::info!("Application started");

Or with custom filter:

use netoptim_rs::logging::init_logger_with_filter;

init_logger_with_filter("debug");
log::debug!("Debug message");

§Environment Variables

  • RUST_LOG: Controls log level (debug, info, warn, error)
  • RUST_LOG_STYLE: Controls colored output

Example:

RUST_LOG=debug cargo run --features std

Functions§

init_logger
Initialize the logger with the default filter.
init_logger_with_filter
Initialize the logger with a custom filter string.
is_logger_initialized
Check if the logger has been initialized.
try_init_logger
Try to initialize the logger without panicking.
try_init_logger_with_filter
Try to initialize the logger with a custom filter without panicking.