mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-26 20:10:09 +00:00
Send logs to stderr (#977)
This commit is contained in:
parent
f6b0a606d6
commit
9e1ba916f0
2 changed files with 2 additions and 9 deletions
|
@ -56,7 +56,7 @@ pub fn set_up_logging(level: &LogLevel) -> Result<()> {
|
||||||
));
|
));
|
||||||
})
|
})
|
||||||
.level(level.level_filter())
|
.level(level.level_filter())
|
||||||
.chain(std::io::stdout())
|
.chain(std::io::stderr())
|
||||||
.apply()?;
|
.apply()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,6 +191,7 @@ fn inner_main() -> Result<ExitCode> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
let fix = cli.fix();
|
let fix = cli.fix();
|
||||||
let log_level = extract_log_level(&cli);
|
let log_level = extract_log_level(&cli);
|
||||||
|
set_up_logging(&log_level)?;
|
||||||
|
|
||||||
if let Some(shell) = cli.generate_shell_completion {
|
if let Some(shell) = cli.generate_shell_completion {
|
||||||
shell.generate(&mut Cli::command(), &mut std::io::stdout());
|
shell.generate(&mut Cli::command(), &mut std::io::stdout());
|
||||||
|
@ -268,14 +269,6 @@ fn inner_main() -> Result<ExitCode> {
|
||||||
let fix_enabled: bool = configuration.fix;
|
let fix_enabled: bool = configuration.fix;
|
||||||
let settings = Settings::from_configuration(configuration, project_root.as_ref())?;
|
let settings = Settings::from_configuration(configuration, project_root.as_ref())?;
|
||||||
|
|
||||||
// If we're using JSON, override the log level.
|
|
||||||
let log_level = if matches!(settings.format, SerializationFormat::Json) {
|
|
||||||
LogLevel::Quiet
|
|
||||||
} else {
|
|
||||||
log_level
|
|
||||||
};
|
|
||||||
set_up_logging(&log_level)?;
|
|
||||||
|
|
||||||
// Now that we've inferred the appropriate log level, add some debug
|
// Now that we've inferred the appropriate log level, add some debug
|
||||||
// information.
|
// information.
|
||||||
match &project_root {
|
match &project_root {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue