dssoca docs
GitHub repository

LogStream

Live, levelled log viewer.

A terminal-style log viewer. Pass controlled `lines` to render exactly those, or let the built-in `demo` ticker simulate a live feed. Includes a controls toolbar (filters, search, wrap, copy, clear) you can replace, a `loading` indicator, a custom `empty` slot, and a `role="log"` region with configurable aria-live announcements.

Demo

live · storybook Open in Storybook

Demo loads from https://dssoca-storybook.vercel.app/. Run pnpm storybook for it to render locally.

Usage

svelte
<script>
  import { LogStream } from 'dssoca';

  const lines = [
    { t: '12:00:01', lvl: 'info', svc: '[hub]', msg: 'session refresh' },
    { t: '12:00:02', lvl: 'err',  svc: '[tasks]', msg: 'EADDRINUSE :3004' },
  ];
</script>

<LogStream {lines} />
<LogStream demo />

Exports the `LogLevel` (`info | warn | err | ok`) and `LogLine` types from `dssoca`. The viewport min/max heights and the timestamp/level column widths are overridable, size-aware tokens: `--ss-log-min-h`, `--ss-log-max-h`, `--ss-log-t-w`, `--ss-log-lvl-w` (md defaults 160/240/58/38px).

Props

PropTypeDefaultDescription
linesLogLine[]Controlled lines. When provided, renders exactly these (capped to `maxLines`); demo off.
initialLinesOmit<LogLine, 'id'>[]Seed lines for the built-in demo stream (used when `lines` is undefined).
demobooleanGenerate a random demo stream. Defaults true ONLY when `lines` is not supplied.
livebooleanBack-compat alias for `demo`.
maxLinesnumber30Max lines kept in the buffer (oldest dropped).
controlsbooleantrueShow the controls toolbar (filters, search, wrap, copy, clear).
toolbarSnippetReplace the built-in toolbar entirely.
wrapbooleantrueWrap long messages (pre-wrap) vs. horizontal scroll (pre).
announce'off' | 'polite' | 'assertive''polite'aria-live politeness for the log region.
ariaLabelstring'Log output'Accessible label for the log region.
loadingbooleanfalseShow a connecting/loading indicator.
emptySnippetCustom empty state.
size'sm' | 'md' | 'lg'Per-instance size override; inherits the ancestor `data-size-variant` when unset.