Set logging to output to file as well

This commit is contained in:
2022-08-10 17:55:56 +02:00
parent 270c138419
commit ce043d670e
6 changed files with 120 additions and 24 deletions

View File

@@ -5,11 +5,12 @@ use std::{
pub struct ShellAction {
path: String,
name: String,
}
impl ShellAction {
pub fn new(path: String) -> Self {
Self { path }
pub fn new(name: String, path: String) -> Self {
Self { path, name }
}
pub fn execute(self) -> anyhow::Result<()> {
@@ -17,6 +18,7 @@ impl ShellAction {
log::info!(
"
===
Starting running shell action: {}
===
@@ -35,7 +37,7 @@ Starting running shell action: {}
let stdout_reader = BufReader::new(stdout);
let mut stdout_lines = stdout_reader.lines();
while let Some(Ok(line)) = stdout_lines.next() {
log::info!("{}", line)
log::info!(process=log::as_display!(self.name); "{}", line)
}
}
@@ -43,6 +45,7 @@ Starting running shell action: {}
log::info!(
"
===
Finished running shell action
===