refactor: LogsTZ from &str
This commit is contained in:
@@ -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
@@ -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(), "");
|
||||
|
||||
Reference in New Issue
Block a user