Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit b703c5c

Browse files
committed
Don't log enormous outputs
1 parent ac799f6 commit b703c5c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/docker.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,15 @@ impl Container {
8080
let mut lock = sink.lock().unwrap();
8181
let output = mem::replace(&mut *lock, Vec::new());
8282
debug!("status: {}", status);
83-
debug!("output: {}", String::from_utf8_lossy(&output));
83+
{
84+
let output_lossy = String::from_utf8_lossy(&output);
85+
if output_lossy.len() < 1024 {
86+
debug!("output: {}", output_lossy);
87+
} else {
88+
let s = output_lossy.chars().take(1024).collect::<String>();
89+
debug!("output (truncated): {}...", s);
90+
}
91+
}
8492
Ok((status, output, timeout))
8593
}
8694
}

0 commit comments

Comments
 (0)