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
// SPDX-License-Identifier: Apache-2.0
//! Logging initialization for the Aptu CLI.
//!
//! Uses `tracing` with `tracing-subscriber` for structured logging.
//! Log level can be controlled via the `RUST_LOG` environment variable.
//!
//! The `-v` flag controls user-facing verbose output (handled separately by `OutputContext`).
//! For debug-level tracing, use the `RUST_LOG` environment variable.
//!
//! # Examples
//!
//! ```bash
//! # Default: info level for aptu, warn for dependencies
//! cargo run
//!
//! # Debug output for troubleshooting
//! RUST_LOG=aptu=debug cargo run
//!
//! # Trace level for verbose debugging
//! RUST_LOG=aptu=trace cargo run
//! ```
use *;
use ;
use crateOutputFormat;
/// Initialize the logging subsystem.
///
/// The `verbose` flag controls user-facing output verbosity (handled separately by `OutputContext`).
/// The `RUST_LOG` environment variable controls debug tracing output.
///
/// # Metrics Collection
///
/// To enable metrics collection, set `RUST_LOG=aptu=info`:
///
/// ```bash
/// RUST_LOG=aptu=info cargo run -- triage <owner>/<repo>/<issue_num>
/// ```
///
/// Metrics are emitted as structured logs containing:
/// - `duration_ms`: Total API request time in milliseconds
/// - `input_tokens`: Number of input tokens used
/// - `output_tokens`: Number of output tokens used
/// - `cost_usd`: Estimated cost in USD (if available)
/// - `model`: AI model name
///
/// Pipe to jq to filter metrics:
///
/// ```bash
/// RUST_LOG=aptu=info cargo run -- triage <owner>/<repo>/<issue_num> 2>&1 | jq 'select(.fields.duration_ms)'
/// ```
///
/// # Arguments
///
/// * `format` - Output format (determines if quiet mode is enabled)
/// * `verbose` - Whether verbose user output is enabled (-v flag)