Send logs to stderr (#977)

This commit is contained in:
Edgar R. M 2022-12-01 09:19:32 -06:00 committed by GitHub
parent f6b0a606d6
commit 9e1ba916f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 9 deletions

View file

@ -56,7 +56,7 @@ pub fn set_up_logging(level: &LogLevel) -> Result<()> {
));
})
.level(level.level_filter())
.chain(std::io::stdout())
.chain(std::io::stderr())
.apply()?;
Ok(())
}

View file

@ -191,6 +191,7 @@ fn inner_main() -> Result<ExitCode> {
let cli = Cli::parse();
let fix = cli.fix();
let log_level = extract_log_level(&cli);
set_up_logging(&log_level)?;
if let Some(shell) = cli.generate_shell_completion {
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 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
// information.
match &project_root {