forked from Proxmox/proxmox
log: print error if env-var parsing failed, print correct name
Print error if the parsing of the env-var fails on the proxmox-backup-* daemons as well. Output correct env-var on binaries that use different variables. Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
This commit is contained in:
parent
c9c9ade96e
commit
5d33d870ee
@ -44,8 +44,13 @@ pub fn init_logger(
|
||||
) -> Result<(), anyhow::Error> {
|
||||
let mut log_level = default_log_level;
|
||||
if let Ok(v) = env::var(env_var_name) {
|
||||
if let Ok(l) = v.parse::<LevelFilter>() {
|
||||
log_level = l;
|
||||
match v.parse::<LevelFilter>() {
|
||||
Ok(l) => {
|
||||
log_level = l;
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("env variable {env_var_name} found, but parsing failed: {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
let registry = tracing_subscriber::registry()
|
||||
@ -165,9 +170,9 @@ pub fn init_cli_logger(
|
||||
match v.parse::<LevelFilter>() {
|
||||
Ok(l) => {
|
||||
log_level = l;
|
||||
},
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("env variable PBS_LOG found, but parsing failed: {e:?}");
|
||||
eprintln!("env variable {env_var_name} found, but parsing failed: {e:?}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user