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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! Telemetry and observability initialization for the Schwab SDK.
//!
//! This module provides convenient functions to initialize tracing/logging
//! for the SDK. It uses the `tracing` crate which provides:
//!
//! - Structured, contextual logging
//! - Span-based performance tracking
//!
//! Applications that export traces install their own subscriber instead;
//! these helpers then leave it in place. With the `otel` feature,
//! `init_otel` is that subscriber for OTLP: it exports spans to whatever
//! the standard `OTEL_EXPORTER_OTLP_*` environment names, and behaves like
//! the helpers below when it names nothing.
//!
//! # Basic Usage
//!
//! ```no_run
//! use rustyschwab::telemetry;
//!
//! // Initialize with default settings (respects RUST_LOG env var)
//! telemetry::init_tracing();
//!
//! // Or with custom settings
//! telemetry::init_tracing_with_level("debug");
//! ```
//!
//! # Environment Variables
//!
//! - `RUST_LOG`: Controls log level and filtering (e.g., `rustyschwab=debug,warn`)
//!
//! # Example with Custom Filter
//!
//! ```bash
//! # Show debug logs for rustyschwab, info for everything else
//! RUST_LOG=rustyschwab=debug,info cargo run
//! ```
pub use ;
/// `RUST_LOG` when set and valid, else `default`.
/// Initialize tracing with default settings.
///
/// Respects the `RUST_LOG` environment variable for filtering.
/// If not set, defaults to `info` level.
///
/// Idempotent, and harmless when the application already installed a
/// global subscriber: that one is kept.
///
/// # Example
///
/// ```no_run
/// rustyschwab::telemetry::init_tracing();
/// ```
/// Initialize tracing with a specific default log level.
///
/// The `RUST_LOG` environment variable takes precedence over the provided level.
///
/// # Arguments
///
/// * `default_level` - Default log level if RUST_LOG is not set
/// (e.g., "debug", "info", "warn", "error", "trace")
///
/// # Example
///
/// ```no_run
/// rustyschwab::telemetry::init_tracing_with_level("debug");
/// ```
/// Initialize tracing with JSON output format.
///
/// Useful for production environments where logs are aggregated
/// and parsed by log management systems.
///
/// # Example
///
/// ```no_run
/// rustyschwab::telemetry::init_tracing_json();
/// ```