1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//! Logging and tracing infrastructure.
//!
//! This module provides a unified logging and tracing setup for the simulator.
//! It supports multiple output formats (JSON, Pretty) and destinations (stdout, file).
//!
//! ## Features
//!
//! - **Multiple output formats**: JSON, Pretty, Compact, Full
//! - **Multiple output targets**: stdout, stderr, file with rotation
//! - **Log rotation**: Time-based and size-based rotation
//! - **Dynamic log level**: Change log level at runtime
//! - **Structured context**: Request tracing with correlation IDs
//! - **OpenTelemetry ready**: Integration layer for distributed tracing
//!
//! # Example
//!
//! ```rust,no_run
//! use mabi_core::logging::{init_logging, LogConfig, LogFormat, LogLevel};
//!
//! // Initialize with default settings
//! init_logging(&LogConfig::default()).expect("Failed to initialize logging");
//!
//! // Or with custom configuration
//! let config = LogConfig::builder()
//! .level(LogLevel::Debug)
//! .format(LogFormat::Json)
//! .build();
//! init_logging(&config).expect("Failed to initialize logging");
//! ```
//!
//! # File Logging with Rotation
//!
//! ```rust,ignore
//! use mabi_core::logging::{LogConfig, LogTarget, RotationConfig, RotationStrategy};
//!
//! let config = LogConfig::builder()
//! .target(LogTarget::File {
//! directory: "/var/log/trap-simulator".into(),
//! filename_prefix: "simulator".into(),
//! rotation: RotationConfig {
//! strategy: RotationStrategy::Daily,
//! max_files: Some(30),
//! },
//! })
//! .build();
//! ```
pub use *;
pub use *;
pub use *;
pub use *;
pub use *;
// Re-export macros at module level
pub use crate::;