Skip to main content

Module tracing_framework

Module tracing_framework 

Source
Expand description

§Tracing Framework for SciRS2 v0.2.0

This module provides structured logging and tracing capabilities using the tracing crate. It enables zero-overhead instrumentation when disabled and comprehensive observability when enabled.

§Features

  • Structured Logging: Rich, structured event logging with context
  • Span Management: Hierarchical span tracking for nested operations
  • Multiple Outputs: Console, file, JSON, and custom exporters
  • Performance Zones: Named zones for performance tracking
  • Zero Overhead: Compile-time elimination when feature is disabled

§Example

use scirs2_core::profiling::tracing_framework::{TracingConfig, init_tracing};
use tracing::{info, span, Level};

// Initialize tracing with default configuration
let _guard = init_tracing(TracingConfig::default()).expect("Failed to initialize tracing");

// Create a span for a computation
let span = span!(Level::INFO, "matrix_multiply", size = 1000);
let _enter = span.enter();

info!("Starting matrix multiplication");
// ... perform computation ...
info!(result = "success", "Matrix multiplication completed");

Structs§

PerfZone
Performance zone marker for critical sections
SpanGuard
Span guard for automatic span management
TracingConfig
Configuration for tracing framework

Enums§

LogRotation
Log rotation strategy
TracingFormat
Output format for tracing

Functions§

init_tracing
Initialize the tracing framework