We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba37036 commit 208b82eCopy full SHA for 208b82e
src/logging.rs
@@ -42,7 +42,14 @@ pub struct TerminalWriterMaker {
42
43
impl std::io::Write for RemoteWriter {
44
fn write(&mut self, buf: &[u8]) -> std::io::Result<usize> {
45
- let body = serde_json::json!({"Log": buf});
+ let log = if let Ok(json_log) = serde_json::from_slice(buf) {
46
+ serde_json::to_string(&json_log).unwrap()
47
+ } else {
48
+ let string = String::from_utf8(buf.to_vec())
49
+ .map_err(|e| std::io::Error::new(std::io::ErrorKind::InvalidData, e))?;
50
+ string
51
+ };
52
+ let body = serde_json::json!({"Log": log});
53
let body = serde_json::to_vec(&body).unwrap();
54
Request::to(&self.target).body(body).send().unwrap();
55
Ok(buf.len())
0 commit comments