Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve log display #3768

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 22, 2024

  1. Improve log display

    Add support for toggling display of timestamps in the logs, so
    the user no longer has to navigate away to the settings page
    to do this. This is available on both PipelineRun and TaskRun
    pages. We always request timestamps and just show / hide them
    depending on the user's preference. This is persisted to browser
    localStorage as with the toggle on the settings page.
    
    Add support for detecting GitHub Actions workflow command-style
    log levels in log output. This provides an improved user
    experience as it allows for filtering logs to hide unwanted
    noise, e.g. debug logs, by default. We may consider allowing
    the format to be customised in a future release depending on
    user feedback.
    
    Refactor the styles so `LogFormat` now correctly owns most
    of the styling of the log content, with `Log` only responsible
    for additional styling of the container.
    
    Refactor use of the `LogsToolbar` component to allow for
    customisable use by third-party consumers of the Dashboard
    components. This means they can much more easily take advantage
    of the new features, such as toggling timestamps and log levels,
    without having to reimplement the menu and related code themselves.
    
    Eliminate redundant use of `split` and `join` calls when processing
    the logs, improving performance. `LogFormat` now receives an
    array of log line objects, pre-parsed into the new structure
    with the `timestamp`, `level` (optional), and `message` fields.
    Where a multiline log is encountered, the timestamp of the first
    line is reused for subsequent lines in that log.
    
    Fix issue where in some cases a blank line did not reserve vertical
    space, leading to cramped display of logs. Now each line is
    guaranteed to occupy a minimum height, ensuring blank lines
    output in the logs to aid in readability are preserved in the UI.
    
    Update `FormattedDate` to add support for displaying seconds, as
    this is quite important in the log context. Default to `false` for
    this setting so existing date / timestamps in other parts of the
    UI are unaffected. The full raw timestamp as received in the logs
    in displayed in a tooltip on hover.
    
    Update unit tests to reflect the new and changed components and
    behaviours.
    
    Update common PipelineRun E2E to exercise the new log toolbar
    and validate the log content is rendered as expected.
    
    Add new stories to cover the new functionality. Update existing
    stories to demonstrate use of the new functionality in context.
    
    Update Carbon:
    - resolve issue with Plex Mono font
    
      Some glyphs weren't included in the Plex version packaged with
      previous Carbon releases, resulting in broken formatting for some
      log content, e.g. using box characters to print tables.
    
      In `@carbon/react` 1.71.0 the Plex version has been updated, as well
      as changing how it's consumed. Instead of a single package with all
      of the font variants, they're now published as separate packages per
      font family. Add the `$use-per-family-plex` flag to our config to
      use these new packages. The custom `$font-path` is still required
      for compatibility with Vite.
    
    - resolve issue with duplicate onChange events from MenuItemSelectable
    
    - resolve issue with duplicate onChange events when clearing a ComboBox
    
    Notes:
    - colours of the log level badges are based on the colours of the
      Carbon `Tag` component, with their opacity reduced so they're
      not as intense due to the potentially large number of them that
      could be displayed in the logs. These all meet minimum colour
      contrast ratio required for WCAG 2.0 level AA (i.e. > 4.5:1).
    - the default log level is 'info' if no log level is explicitly
      provided in the logs, however we only display the badge when
      the log level is explicitly set. This avoids unnecessary and
      unwanted noise / clutter in the logs when not using the new
      log format.
    - highlight and hover state included to highlight log lines, aiding
      in consuming the content, especially with longer log lines where
      the log level badge may not be adjacent to the content being read.
      A future update to the log viewer will add support for line
      wrapping but this is out of scope for this particular change.
    AlanGreene committed Nov 22, 2024
    Configuration menu
    Copy the full SHA
    4746a50 View commit details
    Browse the repository at this point in the history