proxmox-rest-server: replace print with log macro
Signed-off-by: Hannes Laimer <h.laimer@proxmox.com> Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
a6f9cf3d73
commit
8e06108d10
@ -229,7 +229,7 @@ impl ApiConfig {
|
||||
self.request_log = Some(Arc::clone(&request_log));
|
||||
|
||||
commando_sock.register_command("api-access-log-reopen".into(), move |_args| {
|
||||
println!("re-opening access-log file");
|
||||
log::info!("re-opening access-log file");
|
||||
request_log.lock().unwrap().reopen()?;
|
||||
Ok(serde_json::Value::Null)
|
||||
})?;
|
||||
@ -269,7 +269,7 @@ impl ApiConfig {
|
||||
self.auth_log = Some(Arc::clone(&auth_log));
|
||||
|
||||
commando_sock.register_command("api-auth-log-reopen".into(), move |_args| {
|
||||
println!("re-opening auth-log file");
|
||||
log::info!("re-opening auth-log file");
|
||||
auth_log.lock().unwrap().reopen()?;
|
||||
Ok(serde_json::Value::Null)
|
||||
})?;
|
||||
|
@ -35,7 +35,7 @@ where
|
||||
let (conn, _addr) = match socket.accept().await {
|
||||
Ok(data) => data,
|
||||
Err(err) => {
|
||||
eprintln!("failed to accept on control socket {:?}: {}", path, err);
|
||||
log::error!("failed to accept on control socket {:?}: {}", path, err);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
@ -44,7 +44,7 @@ where
|
||||
let cred = match socket::getsockopt(conn.as_raw_fd(), opt) {
|
||||
Ok(cred) => cred,
|
||||
Err(err) => {
|
||||
eprintln!("no permissions - unable to read peer credential - {}", err);
|
||||
log::error!("no permissions - unable to read peer credential - {}", err);
|
||||
continue;
|
||||
}
|
||||
};
|
||||
@ -52,7 +52,7 @@ where
|
||||
// check permissions (same gid, root user, or backup group)
|
||||
let mygid = unsafe { libc::getgid() };
|
||||
if !(cred.uid() == 0 || cred.gid() == mygid || cred.gid() == gid) {
|
||||
eprintln!("no permissions for {:?}", cred);
|
||||
log::error!("no permissions for {:?}", cred);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ where
|
||||
Ok(0) => break,
|
||||
Ok(_) => (),
|
||||
Err(err) => {
|
||||
eprintln!("control socket {:?} read error: {}", path, err);
|
||||
log::error!("control socket {:?} read error: {}", path, err);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -94,9 +94,10 @@ where
|
||||
};
|
||||
|
||||
if let Err(err) = tx.write_all(response.as_bytes()).await {
|
||||
eprintln!(
|
||||
log::error!(
|
||||
"control socket {:?} write response error: {}",
|
||||
path, err
|
||||
path,
|
||||
err
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ impl FileLogger {
|
||||
if let Err(err) = self.file.write_all(line.as_bytes()) {
|
||||
// avoid panicking, log methods should not do that
|
||||
// FIXME: or, return result???
|
||||
eprintln!("error writing to log file - {}", err);
|
||||
log::error!("error writing to log file - {}", err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user