Function ci_manager::util::remove_timestamp_prefixes
source · pub fn remove_timestamp_prefixes(log: &str) -> Cow<'_, str>Expand description
Parse a log and remove line-prefixed timestamps in the format YYYY-MM-DDTHH:MM:SS.0000000Z (ISO 8601).
§Example
let test_str = "2024-02-28T00:03:46.0000000Z [INFO] This is a log message";
let modified = remove_timestamp_prefixes(test_str);
assert_eq!(modified, "[INFO] This is a log message");§Multiple lines
let test_str = "\
2024-02-28T00:03:46.0000000Z [INFO] This is a log message
2024-03-15T20:35:48.9824182Z [ERROR] This is another log message";
let modified = remove_timestamp_prefixes(test_str);
assert_eq!(modified, "\
[INFO] This is a log message
[ERROR] This is another log message");