-
-
Notifications
You must be signed in to change notification settings - Fork 739
fix(cli): logging color #7441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(cli): logging color #7441
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@biomejs/biome": patch | ||
| --- | ||
|
|
||
| Fixed [#3824](https://github.com/biomejs/biome/issues/3824). Now the option CLI `--color` is correctly applied to logging too. | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -850,6 +850,7 @@ pub(crate) trait CommandRunner: Sized { | |||||||||||||||||||
| cli_options.log_file.as_deref(), | ||||||||||||||||||||
| cli_options.log_level, | ||||||||||||||||||||
| cli_options.log_kind, | ||||||||||||||||||||
| cli_options.colors.as_ref(), | ||||||||||||||||||||
| ); | ||||||||||||||||||||
|
Comment on lines
+853
to
854
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Colour preference not applied: You compute CI/GitHub overrides in Align with the updated logging signature: - setup_cli_subscriber(
- cli_options.log_file.as_deref(),
- cli_options.log_level,
- cli_options.log_kind,
- cli_options.colors.as_ref(),
- );
+ let colors = self.get_color();
+ setup_cli_subscriber(
+ cli_options.log_file.as_deref(),
+ cli_options.log_level,
+ cli_options.log_kind,
+ colors,
+ );📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||
| let console = &mut *session.app.console; | ||||||||||||||||||||
| let workspace = &*session.app.workspace; | ||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ use std::fmt::{Display, Formatter}; | |
| use std::fs::File; | ||
| use std::str::FromStr; | ||
|
|
||
| use crate::cli_options::ColorsArg; | ||
| use tracing::Metadata; | ||
| use tracing::subscriber::Interest; | ||
| use tracing_subscriber::filter::LevelFilter; | ||
|
|
@@ -10,7 +11,12 @@ use tracing_subscriber::layer::{Context, Filter, SubscriberExt}; | |
| use tracing_subscriber::util::SubscriberInitExt; | ||
| use tracing_subscriber::{Layer as _, registry}; | ||
|
|
||
| pub fn setup_cli_subscriber(file: Option<&str>, level: LoggingLevel, kind: LoggingKind) { | ||
| pub fn setup_cli_subscriber( | ||
| file: Option<&str>, | ||
| level: LoggingLevel, | ||
| kind: LoggingKind, | ||
| colors: Option<&ColorsArg>, | ||
| ) { | ||
|
Comment on lines
+14
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Accept colour preference by value to avoid lifetime foot‑guns. Change -pub fn setup_cli_subscriber(
+pub fn setup_cli_subscriber(
file: Option<&str>,
level: LoggingLevel,
kind: LoggingKind,
- colors: Option<&ColorsArg>,
+ colors: Option<ColorsArg>,
) {🤖 Prompt for AI Agents |
||
| if level == LoggingLevel::None { | ||
| return; | ||
| } | ||
|
|
@@ -20,7 +26,7 @@ pub fn setup_cli_subscriber(file: Option<&str>, level: LoggingLevel, kind: Loggi | |
| .with_target(false) | ||
| .with_thread_names(true) | ||
| .with_file(true) | ||
| .with_ansi(true); | ||
| .with_ansi(colors.is_none_or(|c| c.is_enabled())); | ||
|
|
||
| if level == LoggingLevel::Tracing { | ||
| format = format.with_span_events(FmtSpan::CLOSE); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct the flag name and wording; match changeset style.
It’s
--colorsin the CLI, not--color. Also prefer the project voice and mention non‑TTY behaviour fixed by this PR.🤖 Prompt for AI Agents