Log Viewer

Log viewer web component: a monospace stream of lines that follows the newest while you're at the bottom, with pause, highlighting and a line cap.

  • 2.2 KB gzipped
  • @lit-material/log-viewer 0.0.3
  • Renders on the server

Example

Install

npm install @lit-material/log-viewer @lit-material/tokens
import "@lit-material/log-viewer";

Link @lit-material/tokens/css/index.css once per page for the colour, type and shape tokens. Install guide

API

<lit-material-log-viewer>

A log viewer: a monospace stream of lines, newest at the bottom.

Properties

PropertyAttributeTypeDefaultDescription
maxLinesmax-linesnumber1000Lines kept; the oldest are dropped past this.
pausedpausedbooleanfalseHold new lines back until set to false again.
wrapwrapbooleanfalseWrap long lines instead of scrolling sideways.
labellabelstring"Log"The accessible name of the log region.
highlightproperty only(line: string) => LogLevel | null | undefined | undefinednoneClassifies a line; return nothing for a plain one.
linesproperty onlystring[]noneThe lines shown, oldest first.

Events

EventDescription
lines-droppeddetail: { count } when max-lines dropped old lines.

CSS parts

PartDescription
viewportThe scrolling area.
lineEach line.
jumpThe "new lines" button.

CSS custom properties

PropertyDescription
--lit-material-log-viewer-heightThe viewport's height (default 320px).

Source on GitHub npm