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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! Observability infrastructure for crash reports, tracing, and debugging.
//!
//! This module provides structured error reporting, tracing with spans, and context tracking
//! to help diagnose issues during analysis. Following the Stillwater
//! principle: "Errors Should Tell Stories" and "Pure Core, Imperative Shell".
//!
//! ## Features
//!
//! - **Panic Hook**: Produces structured crash reports with context
//! - **Structured Tracing**: Log levels and spans for hierarchical context
//! - **Context Tracking**: Thread-local analysis phase and file tracking
//! - **Progress Tracking**: Atomic counters for overall analysis progress
//! - **TUI Compatibility**: Automatic output suppression during TUI mode
//!
//! ## Usage
//!
//! Install the panic hook and initialize tracing at application startup:
//!
//! ```ignore
//! use debtmap::observability::{install_panic_hook, init_tracing};
//!
//! fn main() {
//! install_panic_hook();
//! init_tracing();
//! // ... rest of application
//! }
//! ```
//!
//! Track context during analysis:
//!
//! ```ignore
//! use debtmap::observability::{set_phase, set_current_file, AnalysisPhase};
//!
//! fn analyze_files(files: &[PathBuf]) {
//! let _phase = set_phase(AnalysisPhase::Parsing);
//! for file in files {
//! let _file_guard = set_current_file(file);
//! // If panic occurs here, crash report shows phase and file
//! parse_file(file)?;
//! }
//! }
//! ```
//!
//! ## Logging with Tracing
//!
//! Control verbosity with RUST_LOG environment variable:
//!
//! ```bash
//! # Default: warnings and errors only
//! debtmap analyze .
//!
//! # Show phase-level progress
//! RUST_LOG=info debtmap analyze .
//!
//! # Detailed debugging output
//! RUST_LOG=debug debtmap analyze .
//!
//! # Debug specific modules
//! RUST_LOG=debtmap::builders=debug debtmap analyze .
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;