mirror of
https://git.proxmox.com/git/proxmox-backup
synced 2025-05-09 21:43:07 +00:00

Add tracing logger to all client binaries and remove env_logger. The reason for this change is twofold: our migration to tracing, and the behavior when the client calls an api handler directly. Currently the proxmox-backup-manager calls the api handlers directly for some commands. This results in no output (on console and task log), as no tracing logger is instantiated. Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
33 lines
964 B
Rust
33 lines
964 B
Rust
use proxmox_log::init_cli_logger;
|
|
use proxmox_router::{
|
|
cli::{run_cli_command, CliCommandMap, CliEnvironment},
|
|
RpcEnvironment,
|
|
};
|
|
|
|
mod proxmox_backup_debug;
|
|
use proxmox_backup_debug::*;
|
|
|
|
fn main() {
|
|
init_cli_logger("PBS_LOG", proxmox_log::LevelFilter::INFO).expect("failed to initiate logger");
|
|
|
|
let cmd_def = CliCommandMap::new()
|
|
.insert("inspect", inspect::inspect_commands())
|
|
.insert("recover", recover::recover_commands())
|
|
.insert("api", api::api_commands())
|
|
.insert("diff", diff::diff_commands());
|
|
|
|
let uid = nix::unistd::Uid::current();
|
|
let username = match nix::unistd::User::from_uid(uid) {
|
|
Ok(Some(user)) => user.name,
|
|
_ => "root@pam".to_string(),
|
|
};
|
|
let mut rpcenv = CliEnvironment::new();
|
|
rpcenv.set_auth_id(Some(format!("{}@pam", username)));
|
|
|
|
run_cli_command(
|
|
cmd_def,
|
|
rpcenv,
|
|
Some(|future| proxmox_async::runtime::main(future)),
|
|
);
|
|
}
|