Skip to content
synccn

Log Viewer

New

Streaming logs with level filters and counts, search highlighting, wrapping and follow mode that pauses when you scroll up.

web · production

infoCloning github.com/example/web (branch: main, commit: 4f2a9c1)
infoInstalling dependencies with pnpm 10.4.0
debugResolved 1,284 packages in 5.3s (cache hit 96%)
warnPeer dependency react@^18 wanted by legacy-chart, found 19.3.1
infoCompiled 412 modules in 4.4s
infoUploading 86 static assets to iad1, fra1, hnd1

Installation

$ pnpm dlx shadcn@latest add @synccn/log-viewer

First time in this project? Connect synccn with one command.

Usage

import { LogViewer } from "@/components/ui/log-viewer";<LogViewer lines={lines} title="web · production" />

API reference

Generated from the component's TypeScript types, so it always matches the code.

LogViewer

Streaming log output with level filters, search, line wrapping and follow mode. New lines stay in view while you're at the bottom; scroll up to read and a "new lines" button appears instead of the view jumping.

  • linesrequired
    LogLine[]

    Lines, oldest first. Append to stream.

  • follow
    boolean

    Default true

    Keeps the newest line in view while the person is at the bottom. Scrolling up pauses it.

  • height
    number

    Default 320

    Height of the scrolling area, in pixels.

  • maxLines
    number

    Default 1000

    Only the newest lines are rendered beyond this.

  • formatTime
    (date: Date) => string

    Default utcTime

    Formats timestamps. Defaults to UTC HH:MM:SS.mmm, which renders the same on the server and in the browser.

  • defaultLevels
    "debug" | "info" | "warn" | "error"[]

    Default LEVELS

    Levels shown at first.

  • title
    React.ReactNode

    Heading shown in the toolbar.

  • actions
    React.ReactNode

    Extra buttons for the toolbar, such as Clear or Download.

  • className
    string

    Extra classes for the root element.

Dependencies

Read from the component's imports when the site builds. The CLI installs all of these for you.

Helpers

npm packages

Keyboard

  • TabMove between level filters, search, wrap and the log
  • ↑or↓Scroll the focused log

Accessibility

  • The output is a log region that isn't read aloud line by line; new lines arriving while scrolled up are announced as a count.
  • Level filters are toggle buttons with aria-pressed, and each line's level is written out for screen readers.

From the source

Read from this component's code when the site builds, so it can't drift.

  • ARIA roles: group, log
  • ARIA attributes: aria-label, aria-live, aria-pressed
  • Shows a visible focus ring for keyboard users
  • Includes text only screen readers hear
  • Labels are tied to their controls
  • Announces changes to screen readers