move response to debug level, minor fmt optimizations

This commit is contained in:
yggverse 2026-04-07 14:37:04 +03:00
parent f3d69c3ef9
commit e032a1c93b

View file

@ -125,10 +125,12 @@ async fn main() {
}) })
}) { }) {
match database.process(&item.id) { match database.process(&item.id) {
Ok(()) => info!( Ok(()) => {
"exec `{cmd}` for channel `{c}` successful: `{:?}`", info!(
response "exec `{cmd}` for channel `{c}` successful."
), );
debug!("stdout: `{response:?}`");
}
Err(e) => panic!( Err(e) => panic!(
"can't persist processed item `{}` for channel `{c}` by `{cmd}`: `{e}`", "can't persist processed item `{}` for channel `{c}` by `{cmd}`: `{e}`",
item.id item.id
@ -136,14 +138,12 @@ async fn main() {
} }
} else { } else {
warn!( warn!(
"unexpected exec result `{cmd}` for channel `{c}`: `{:?}`", "unexpected exec result `{cmd}` for channel `{c}`: `{response:?}`"
response
) )
} }
} else { } else {
warn!( warn!(
"exec `{cmd}` for channel `{c}` failed: `{:?}`", "exec `{cmd}` for channel `{c}` failed: `{response:?}`",
response
) )
} }
} }
@ -189,15 +189,13 @@ fn cmd(command: &config::Command) {
v.iter() v.iter()
.all(|s| String::from_utf8_lossy(&response.stdout).contains(s)) .all(|s| String::from_utf8_lossy(&response.stdout).contains(s))
}) { }) {
info!("exec `{}` successful: `{:?}`", command.exec, response) info!("exec `{}` successful.", command.exec);
debug!("stdout: `{response:?}`");
} else { } else {
panic!( panic!("unexpected exec result `{}`: `{response:?}`", command.exec)
"unexpected exec result `{}`: `{:?}`",
command.exec, response
)
} }
} else { } else {
panic!("exec `{}` failed: `{:?}`", command.exec, response) panic!("exec `{}` failed: `{response:?}`", command.exec)
} }
} }
Err(e) => panic!("can't execute `{}`: `{e}`", command.exec), Err(e) => panic!("can't execute `{}`: `{e}`", command.exec),