refactor: LogsTZ from &str

This commit is contained in:
Jack Wills
2023-10-18 10:25:34 +00:00
parent 3fd3915b3e
commit 44f581f5b3
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -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::<String>())
}
}
+1 -1
View File
@@ -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(), "");