9348: output to log file if RA_LOG_FILE is defined in environment r=rezural a=rezural

This adds a check for RA_LOG_FILE, and logs to that if defined. It currently overrides flags.log_file. If this is undesirable, I will add a check.

Co-authored-by: rezural <rezural@protonmail.com>
This commit is contained in:
bors[bot] 2021-06-21 21:42:02 +00:00 committed by GitHub
commit 37dc2dfada
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -60,7 +60,14 @@ fn try_main() -> Result<()> {
}
}
setup_logging(flags.log_file.as_deref(), flags.no_log_buffering)?;
let mut log_file = flags.log_file.as_deref();
let env_log_file = env::var("RA_LOG_FILE").ok();
if let Some(env_log_file) = env_log_file.as_deref() {
log_file = Some(Path::new(env_log_file));
}
setup_logging(log_file, flags.no_log_buffering)?;
let verbosity = flags.verbosity();
match flags.subcommand {