Module logging

Module logging 

Source
Expand description

§Logging and Diagnostics

This module provides structured logging and diagnostics utilities for scientific computing.

§Features

  • Structured logging for scientific computing
  • Enhanced progress tracking with multiple visualization styles
  • Performance metrics collection
  • Log filtering and formatting
  • Multi-progress tracking for parallel operations
  • Adaptive update rates and predictive ETA calculations

§Usage

use scirs2_core::logging::{Logger, LogLevel, ProgressTracker};
use scirs2_core::logging::progress::{ProgressBuilder, ProgressStyle};

// Create a logger
let logger = Logger::new("matrix_operations");

// Log messages at different levels
logger.info("Starting matrix multiplication");
logger.debug("Using algorithm: Standard");

// Create an enhanced progress tracker
let mut progress = ProgressBuilder::new("Matrix multiplication", 1000)
    .style(ProgressStyle::DetailedBar)
    .show_statistics(true)
    .build();

progress.start();

for i in 0..1000 {
    // Perform computation

    // Update progress
    progress.update(i + 1);

    // Log intermediate results at low frequency to avoid flooding logs
    if i % 100 == 0 {
        logger.debug(&format!("Completed {}/1000 iterations", i + 1));
    }
}

// Complete the progress tracking
progress.finish();

logger.info("Matrix multiplication completed");

Modules§

distributed
Distributed logging capabilities for multi-node computations
progress
Enhanced Progress Visualization
rate_limiting
Smart rate limiting for high-frequency log events

Structs§

ConsoleLogHandler
Console log handler
FileLogHandler
File log handler
LogEntry
Structured log entry
Logger
Logger for a specific module
LoggerConfig
Logger configuration
ProgressTracker
Progress tracker for long-running operations

Enums§

LogLevel
Log level enumeration

Traits§

LogHandler
Handler trait for processing log entries

Functions§

clearlog_handlers
Clear all log handlers
configurelogger
Configure the global logger
init
Initialize the default logging system
resetlog_handlers
Reset log handlers to the default configuration
set_handler
Register a log handler
set_level
Set the global minimum log level
set_module_level
Set a module-specific log level