@@ -49,19 +49,36 @@ pub enum Error {
49
49
///
50
50
/// #[tokio::main]
51
51
/// async fn main() -> Result<(), Error> {
52
+ /// // This can come from a Clap argument for example. The enabled builder
53
+ /// // function below allows enabling/disabling certain subscribers during
54
+ /// // runtime.
55
+ /// let otlp_log_flag = false;
56
+ ///
52
57
/// // IMPORTANT: Name the guard variable appropriately, do not just use
53
58
/// // `let _ =`, as that will drop immediately.
54
59
/// let _tracing_guard = Tracing::builder()
55
60
/// .service_name("test")
56
61
/// .with_console_output(
57
62
/// Settings::builder()
58
- /// .environment_variable("TEST_CONSOLE")
59
- /// .default_level(LevelFilter::INFO)
63
+ /// .with_environment_variable("TEST_CONSOLE")
64
+ /// .with_default_level(LevelFilter::INFO)
65
+ /// .enabled(true)
66
+ /// .build()
67
+ /// )
68
+ /// .with_otlp_log_exporter(
69
+ /// Settings::builder()
70
+ /// .with_environment_variable("TEST_OTLP_LOG")
71
+ /// .with_default_level(LevelFilter::DEBUG)
72
+ /// .enabled(otlp_log_flag)
73
+ /// .build()
74
+ /// )
75
+ /// .with_otlp_trace_exporter(
76
+ /// Settings::builder()
77
+ /// .with_environment_variable("TEST_OTLP_TRACE")
78
+ /// .with_default_level(LevelFilter::TRACE)
60
79
/// .enabled(true)
61
80
/// .build()
62
81
/// )
63
- /// .with_otlp_log_exporter(("TEST_OTLP_LOG", LevelFilter::DEBUG).into())
64
- /// .with_otlp_trace_exporter(("TEST_OTLP_TRACE", LevelFilter::TRACE).into())
65
82
/// .build()
66
83
/// .init()?;
67
84
///
0 commit comments