Log errors as internal lines

This commit is contained in:
Joscha 2024-05-13 16:56:45 +02:00
parent 5e52c6f2be
commit dbb9d487b3

View file

@ -58,6 +58,7 @@ impl RunInProgress {
.rev() .rev()
.cloned() .cloned()
.collect(); .collect();
UnfinishedRun { UnfinishedRun {
id: self.run.id.clone(), id: self.run.id.clone(),
hash: self.run.hash.clone(), hash: self.run.hash.clone(),
@ -67,6 +68,10 @@ impl RunInProgress {
} }
} }
pub fn log_internal(&self, line: String) {
self.output.lock().unwrap().push((Source::Internal, line));
}
pub fn log_stdout(&self, line: String) { pub fn log_stdout(&self, line: String) {
self.output.lock().unwrap().push((Source::Stdout, line)); self.output.lock().unwrap().push((Source::Stdout, line));
} }
@ -76,6 +81,7 @@ impl RunInProgress {
} }
pub async fn perform(&self, server: &Server) -> Option<FinishedRun> { pub async fn perform(&self, server: &Server) -> Option<FinishedRun> {
// TODO Log system info
// TODO Handle aborts // TODO Handle aborts
let result = match &self.run.bench_method { let result = match &self.run.bench_method {
BenchMethod::Internal => self.perform_internal(server), BenchMethod::Internal => self.perform_internal(server),
@ -87,8 +93,8 @@ impl RunInProgress {
Ok(outcome) => outcome, Ok(outcome) => outcome,
Err(e) => { Err(e) => {
error!("Error during run for {}:\n{e:?}", server.name); error!("Error during run for {}:\n{e:?}", server.name);
self.log_stderr("Internal error:".to_string()); self.log_internal("Internal error:".to_string());
self.log_stderr(format!("{e:?}")); self.log_internal(format!("{e:?}"));
Some(Finished { Some(Finished {
exit_code: -1, exit_code: -1,
measurements: HashMap::new(), measurements: HashMap::new(),