refactor(tvix/tracing): drop log_level method
There's no more consumers left. Change-Id: I0585abbdbe0ffcf35cd20ac58077ade67cbf5c75 Reviewed-on: https://cl.tvl.fyi/c/depot/+/12715 Reviewed-by: Ilan Joselevich <personal@ilanjoselevich.com> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
This commit is contained in:
parent
38f27c4502
commit
eb2ca5f079
1 changed files with 4 additions and 24 deletions
|
@ -1,7 +1,7 @@
|
||||||
use indicatif::ProgressStyle;
|
use indicatif::ProgressStyle;
|
||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
use tokio::sync::{mpsc, oneshot};
|
use tokio::sync::{mpsc, oneshot};
|
||||||
use tracing::Level;
|
use tracing::level_filters::LevelFilter;
|
||||||
use tracing_indicatif::{
|
use tracing_indicatif::{
|
||||||
filter::IndicatifFilter, util::FilteredFormatFields, writer, IndicatifLayer, IndicatifWriter,
|
filter::IndicatifFilter, util::FilteredFormatFields, writer, IndicatifLayer, IndicatifWriter,
|
||||||
};
|
};
|
||||||
|
@ -145,34 +145,15 @@ impl TracingHandle {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
pub struct TracingBuilder {
|
pub struct TracingBuilder {
|
||||||
level: Level,
|
|
||||||
progess_bar: bool,
|
progess_bar: bool,
|
||||||
|
|
||||||
#[cfg(feature = "otlp")]
|
#[cfg(feature = "otlp")]
|
||||||
service_name: Option<&'static str>,
|
service_name: Option<&'static str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for TracingBuilder {
|
|
||||||
fn default() -> Self {
|
|
||||||
TracingBuilder {
|
|
||||||
level: Level::INFO,
|
|
||||||
progess_bar: false,
|
|
||||||
|
|
||||||
#[cfg(feature = "otlp")]
|
|
||||||
service_name: None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TracingBuilder {
|
impl TracingBuilder {
|
||||||
/// Set the log level for all layers: stderr und otlp if configured. RUST_LOG still has a
|
|
||||||
/// higher priority over this value.
|
|
||||||
pub fn level(mut self, level: Level) -> TracingBuilder {
|
|
||||||
self.level = level;
|
|
||||||
self
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "otlp")]
|
#[cfg(feature = "otlp")]
|
||||||
/// Enable otlp by setting a custom service_name
|
/// Enable otlp by setting a custom service_name
|
||||||
pub fn enable_otlp(mut self, service_name: &'static str) -> TracingBuilder {
|
pub fn enable_otlp(mut self, service_name: &'static str) -> TracingBuilder {
|
||||||
|
@ -187,8 +168,7 @@ impl TracingBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This will setup tracing based on the configuration passed in.
|
/// This will setup tracing based on the configuration passed in.
|
||||||
/// It will setup a stderr writer output layer and a EnvFilter based on the provided log
|
/// It will setup a stderr writer output layer and configure EnvFilter to honor RUST_LOG.
|
||||||
/// level (RUST_LOG still has a higher priority over the configured value).
|
|
||||||
/// The EnvFilter will be applied to all configured layers, also otlp.
|
/// The EnvFilter will be applied to all configured layers, also otlp.
|
||||||
///
|
///
|
||||||
/// It will also configure otlp if the feature is enabled and a service_name was provided. It
|
/// It will also configure otlp if the feature is enabled and a service_name was provided. It
|
||||||
|
@ -201,7 +181,7 @@ impl TracingBuilder {
|
||||||
let subscriber = tracing_subscriber::registry()
|
let subscriber = tracing_subscriber::registry()
|
||||||
.with(
|
.with(
|
||||||
EnvFilter::builder()
|
EnvFilter::builder()
|
||||||
.with_default_directive(self.level.into())
|
.with_default_directive(LevelFilter::INFO.into())
|
||||||
.from_env()
|
.from_env()
|
||||||
.expect("invalid RUST_LOG"),
|
.expect("invalid RUST_LOG"),
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue