diff --git a/.changeset/cold-webs-vanish.md b/.changeset/cold-webs-vanish.md new file mode 100644 index 000000000000..d4b12cc4cb24 --- /dev/null +++ b/.changeset/cold-webs-vanish.md @@ -0,0 +1,5 @@ +--- +"@biomejs/biome": patch +--- + +Fixed a bug where logs were discarded (the kind from `--log-level=info` etc.). This is a regression introduced after an internal refactor that wasn't adequately tested. diff --git a/crates/biome_cli/src/logging.rs b/crates/biome_cli/src/logging.rs index 1ef5d32a0140..c3f296f30327 100644 --- a/crates/biome_cli/src/logging.rs +++ b/crates/biome_cli/src/logging.rs @@ -44,14 +44,15 @@ pub fn setup_cli_subscriber( .with_span_events(fmt_span) .with_writer(make_writer); - let layer = match kind { - LoggingKind::Pretty => layer.pretty().first(), - LoggingKind::Compact => layer.compact().second(), - LoggingKind::Json => layer.json().flatten_event(true).third(), - } - .with_filter(LoggingFilter { level }); - - registry().with(layer).init(); + let registry = registry(); + let filter = LoggingFilter { level }; + match kind { + LoggingKind::Pretty => registry.with(layer.pretty().with_filter(filter)).init(), + LoggingKind::Compact => registry.with(layer.compact().with_filter(filter)).init(), + LoggingKind::Json => registry + .with(layer.json().flatten_event(true).with_filter(filter)) + .init(), + }; } #[derive(Copy, Debug, Default, Clone, Ord, PartialOrd, Eq, PartialEq)] @@ -195,11 +196,8 @@ mod tracing_subscriber_ext { //! //! This module is kept private to preserve API flexibility. - use tracing::{Metadata, Subscriber}; - use tracing_subscriber::{ - Layer, - fmt::{MakeWriter, writer::OptionalWriter}, - }; + use tracing::Metadata; + use tracing_subscriber::fmt::{MakeWriter, writer::OptionalWriter}; /// A wrapper type for an optional [MakeWriter]. /// @@ -241,53 +239,6 @@ mod tracing_subscriber_ext { OptionMakeWriter(self) } } - - /// A wrapper type for one of three possible values. - /// - /// Implements [Layer] if `First`, `Second`, and `Third` all implement [Layer]. - pub(super) enum OrderedVariants { - First(First), - Second(Second), - Third(Third), - } - - impl Layer for OrderedVariants - where - First: Layer, - Second: Layer, - Third: Layer, - S: Subscriber, - { - } - - /// Extension trait for creating [OrderedVariants]. - pub(super) trait OrderedVariantsExt { - /// Wraps `self` in the [OrderedVariants::First] variant. - fn first(self) -> OrderedVariants - where - Self: Sized, - { - OrderedVariants::First(self) - } - - /// Wraps `self` in the [OrderedVariants::Second] variant. - fn second(self) -> OrderedVariants - where - Self: Sized, - { - OrderedVariants::Second(self) - } - - /// Wraps `self` in the [OrderedVariants::Third] variant. - fn third(self) -> OrderedVariants - where - Self: Sized, - { - OrderedVariants::Third(self) - } - } - - impl OrderedVariantsExt for T {} } #[cfg(test)]