Skip to content

Commit f1e4696

Browse files
cormacrelfematipicodyc3
authored
fix(cli): revert some of PR #7531 to re-enable logging (#8256)
Co-authored-by: Emanuele Stoppa <[email protected]> Co-authored-by: Carson McManus <[email protected]>
1 parent 98ca2ae commit f1e4696

2 files changed

Lines changed: 16 additions & 60 deletions

File tree

.changeset/cold-webs-vanish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@biomejs/biome": patch
3+
---
4+
5+
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.

crates/biome_cli/src/logging.rs

Lines changed: 11 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ pub fn setup_cli_subscriber(
4444
.with_span_events(fmt_span)
4545
.with_writer(make_writer);
4646

47-
let layer = match kind {
48-
LoggingKind::Pretty => layer.pretty().first(),
49-
LoggingKind::Compact => layer.compact().second(),
50-
LoggingKind::Json => layer.json().flatten_event(true).third(),
51-
}
52-
.with_filter(LoggingFilter { level });
53-
54-
registry().with(layer).init();
47+
let registry = registry();
48+
let filter = LoggingFilter { level };
49+
match kind {
50+
LoggingKind::Pretty => registry.with(layer.pretty().with_filter(filter)).init(),
51+
LoggingKind::Compact => registry.with(layer.compact().with_filter(filter)).init(),
52+
LoggingKind::Json => registry
53+
.with(layer.json().flatten_event(true).with_filter(filter))
54+
.init(),
55+
};
5556
}
5657

5758
#[derive(Copy, Debug, Default, Clone, Ord, PartialOrd, Eq, PartialEq)]
@@ -195,11 +196,8 @@ mod tracing_subscriber_ext {
195196
//!
196197
//! This module is kept private to preserve API flexibility.
197198
198-
use tracing::{Metadata, Subscriber};
199-
use tracing_subscriber::{
200-
Layer,
201-
fmt::{MakeWriter, writer::OptionalWriter},
202-
};
199+
use tracing::Metadata;
200+
use tracing_subscriber::fmt::{MakeWriter, writer::OptionalWriter};
203201

204202
/// A wrapper type for an optional [MakeWriter].
205203
///
@@ -241,53 +239,6 @@ mod tracing_subscriber_ext {
241239
OptionMakeWriter(self)
242240
}
243241
}
244-
245-
/// A wrapper type for one of three possible values.
246-
///
247-
/// Implements [Layer] if `First`, `Second`, and `Third` all implement [Layer].
248-
pub(super) enum OrderedVariants<First, Second, Third> {
249-
First(First),
250-
Second(Second),
251-
Third(Third),
252-
}
253-
254-
impl<First, Second, Third, S> Layer<S> for OrderedVariants<First, Second, Third>
255-
where
256-
First: Layer<S>,
257-
Second: Layer<S>,
258-
Third: Layer<S>,
259-
S: Subscriber,
260-
{
261-
}
262-
263-
/// Extension trait for creating [OrderedVariants].
264-
pub(super) trait OrderedVariantsExt {
265-
/// Wraps `self` in the [OrderedVariants::First] variant.
266-
fn first<Second, Third>(self) -> OrderedVariants<Self, Second, Third>
267-
where
268-
Self: Sized,
269-
{
270-
OrderedVariants::First(self)
271-
}
272-
273-
/// Wraps `self` in the [OrderedVariants::Second] variant.
274-
fn second<First, Third>(self) -> OrderedVariants<First, Self, Third>
275-
where
276-
Self: Sized,
277-
{
278-
OrderedVariants::Second(self)
279-
}
280-
281-
/// Wraps `self` in the [OrderedVariants::Third] variant.
282-
fn third<First, Second>(self) -> OrderedVariants<First, Second, Self>
283-
where
284-
Self: Sized,
285-
{
286-
OrderedVariants::Third(self)
287-
}
288-
}
289-
290-
impl<T> OrderedVariantsExt for T {}
291242
}
292243

293244
#[cfg(test)]

0 commit comments

Comments
 (0)