terra vidhal

Log Stream

Component

About

A live log stream with pause and resume, level filters and counts, a distribution bar, search, expandable details, pinning, clear, reset, animated entries and an auto-follow tail toggle.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Log Stream to your project and fits it to your theme.

Code

How Log Stream is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

/**
 * PrequelUI Animate — MIT — https://prequeluianimate.terravidhal.me
 */

import { LogStream, type LogEntry, type LogTemplate } from "@/components/ui/log-stream";

const ENTRIES: LogEntry[] = [
  { id: "e1", level: "info", source: "api", message: "GET /v2/projects 200 42ms", time: "10:41:52", detail: "request_id=req_8f21 route=/v2/projects status=200 duration=42ms" },
  { id: "e2", level: "debug", source: "cache", message: "hit projects:list ttl=120", time: "10:41:53", detail: "key=projects:list:acct_5521 ttl=120s size=3.4kb" },
  { id: "e3", level: "warn", source: "worker", message: "retrying job export-42 attempt 2", time: "10:41:55", detail: "job=export-42 attempt=2 backoff=800ms reason=timeout" },
  { id: "e4", level: "info", source: "auth", message: "token refreshed for user usr_184", time: "10:41:57", detail: "user=usr_184 method=refresh expires_in=3600" },
  { id: "e5", level: "error", source: "billing", message: "payment provider returned 502", time: "10:41:59", detail: "provider=checkout status=502 request=pay_7c1a retryable=true" },
  { id: "e6", level: "info", source: "api", message: "POST /v2/projects 201 118ms", time: "10:42:01", detail: "request_id=req_9a02 route=/v2/projects status=201 duration=118ms" },
  { id: "e7", level: "debug", source: "queue", message: "dequeued email.digest batch=12", time: "10:42:03", detail: "queue=email.digest batch=12 workers=4 lag=0ms" },
  { id: "e8", level: "warn", source: "api", message: "rate limit at 82% for acct_5521", time: "10:42:05", detail: "account=acct_5521 window=60s used=820 limit=1000" },
  { id: "e9", level: "info", source: "worker", message: "export-42 completed in 2.4s", time: "10:42:07", pinned: true, detail: "job=export-42 status=done duration=2410ms rows=1842" },
];

const STREAM: LogTemplate[] = [
  { level: "info", source: "api", message: "GET /v2/reports 200 67ms", detail: "route=/v2/reports status=200 duration=67ms" },
  { level: "debug", source: "cache", message: "miss reports:weekly", detail: "key=reports:weekly:acct_5521 state=miss" },
  { level: "warn", source: "worker", message: "slow query on reports.daily 1.8s", detail: "table=reports.daily duration=1804ms threshold=1500ms" },
  { level: "info", source: "queue", message: "processed webhook delivery 118", detail: "queue=webhooks id=118 attempt=1" },
  { level: "error", source: "auth", message: "expired session rejected", detail: "reason=expired path=/v2/settings" },
  { level: "info", source: "api", message: "PATCH /v2/settings 200 91ms", detail: "route=/v2/settings status=200 duration=91ms" },
];

export default function LogStreamDemo() {
  return (
    <main className="flex min-h-screen w-full items-start justify-center bg-gradient-to-b from-muted/40 via-background to-background px-4 py-8 sm:px-6">
      <LogStream
        initialEntries={ENTRIES}
        stream={STREAM}
        title="Production event stream"
        intervalMs={2200}
      />
    </main>
  );
}

Dependencies

More by terra vidhal

View all
  • Project Timeline

    Project Timeline

    30
  • Kanban Board

    Kanban Board

    20
  • Gravity Stars Background

    Gravity Stars Background

    20
  • Booking Calendar

    Booking Calendar

    18
  • Notification Center

    Notification Center

    16
  • Audio Waveform

    Audio Waveform

    16
  • Kpi Counter

    Kpi Counter

    16
  • Topographic Lines

    Topographic Lines

    16

Explore more

Part of PrequelUI Animate — browse the full library on 21st.dev.