diff --git a/src/app_data/container_state.rs b/src/app_data/container_state.rs index 26b3272..607baa8 100644 --- a/src/app_data/container_state.rs +++ b/src/app_data/container_state.rs @@ -341,8 +341,8 @@ pub struct LogsTz(String); /// The docker log, which should always contain a timestamp, is in the format `2023-01-14T19:13:30.783138328Z Lorem ipsum dolor sit amet` /// So just split at the inclusive index of the first space, needs to be inclusive, hence the use of format to at the space, so that we can remove the whole thing when the `-t` flag is set /// Need to make sure that this isn't an empty string?! -impl From<&String> for LogsTz { - fn from(value: &String) -> Self { +impl From<&str> for LogsTz { + fn from(value: &str) -> Self { Self(value.split_inclusive(' ').take(1).collect::()) } } diff --git a/src/app_data/mod.rs b/src/app_data/mod.rs index 6abeacc..903090e 100644 --- a/src/app_data/mod.rs +++ b/src/app_data/mod.rs @@ -625,7 +625,7 @@ impl AppData { let current_len = container.logs.len(); for mut i in logs { - let tz = LogsTz::from(&i); + let tz = LogsTz::from(i.as_str()); // Strip the timestamp if `-t` flag set if !timestamp { i = i.replace(&tz.to_string(), "");