feat: format log file to be more markdown

Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
Lars Wirzenius
2023-12-14 18:11:00 +02:00
parent 7063304e6f
commit f5f4750471
+17 -5
View File
@@ -114,13 +114,13 @@ fn run(
.map_err(|e| NativeError::CreateLog(log_filename.into(), e))?,
);
logmsg(log_filename, &mut log, "=== Radicle native CI\n".into())?;
logmsg(log_filename, &mut log, "# Radicle native CI\n".into())?;
logmsg(
log_filename,
&mut log,
format!("=== Repository id: {}\n", repo),
format!("# Repository id: {}\n", repo),
)?;
logmsg(log_filename, &mut log, format!("=== Commit: {}\n", commit))?;
logmsg(log_filename, &mut log, format!("# Commit: {}\n", commit))?;
write_response(&Response::triggered(RunId::from(
run_id.to_string().as_str(),
@@ -166,7 +166,6 @@ fn runcmd(
argv: &[&str],
cwd: &Path,
) -> Result<(), NativeError> {
logmsg(log_filename, log, format!("=== Run: {:?}\n---\n", argv))?;
let mut p = Popen::create(
argv,
PopenConfig {
@@ -177,13 +176,26 @@ fn runcmd(
},
)
.map_err(|e| NativeError::PopenCreate(format!("{:?}", argv), e))?;
logmsg(
log_filename,
log,
format!(
"# Run command\n\nCommand:\n~~~\n{:?}\n~~~\n\nOutput:\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n",
argv
),
)?;
p.communicate(None)
.map_err(|e| NativeError::ChildComms(format!("{:?}", argv), e))?;
let exit = p
.wait()
.map_err(|e| NativeError::PopenFailed(format!("{:?}", argv), e))?;
debug!("exit: {:?}", exit);
logmsg(log_filename, log, "...\n".into())?;
logmsg(
log_filename,
log,
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n\n".into(),
)?;
if !exit.success() {
let error = Response::error(&format!("command failed: {:?}", argv));
error