Skip to content

Make date formatting more reliable #33

@rgwood

Description

@rgwood

The code that highlights dates for log lines is pretty bad:

if let Some((date, rest)) = l.splitn(2, ' ').collect_tuple() {
// This is not a good way to identify dates; the length can vary by system.
// TODO: find a better way to identify dates
if date.len() != 25 {
return Line::from(l.as_str());
}
Line::from(vec![Span::styled(date, Style::default().fg(Color::DarkGray)), Span::raw(" "), Span::raw(rest)])

It assumes that dates are in a certain format (no spaces) and length (25 chars). This works on my machine ™ but won't work on everyone's. Figure out a better way to do this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions