Moul UIBeta
Components

Logs

High-performance log stream and event viewer component built on React Aria Table and StyleX.

Logs

The Logs component is an accessible, developer-focused log stream viewer built on top of React Aria Table and styled with StyleX design tokens. It provides real-time search, severity level filtering, key-value attribute inspection, line wrapping toggles, and detail inspection panels.

Import

import { Logs, SERVER_LOGS, parseLogs } from '@moul-dev/ui';

Preview

Mould Engine Server Logs

17 / 17 events
17 logs displayed
#TimestampLevelMessageActions
12026/08/19 11:16:49INFO
Starting mould engine server
addr=http://localhost:8090env=developmentversion=dev
22026/08/19 11:16:49INFO
Request tracking flusher started
component=analytics
32026/08/19 11:16:50DEBUG
Flushed request records
component=analyticscount=12
42026/08/19 11:16:52INFO
HTTP request
bytes_sent=48ip=127.0.0.1latency=182.4µsmethod=GETpath=/api/healthstatus=200
52026/08/19 11:16:55INFO
HTTP request
bytes_sent=1420email=alex@example.comip=192.168.1.45latency=3.12msmethod=GETpath=/api/mouls/posts/recordsstatus=200user_id=usr_01j7k9p2
62026/08/19 11:17:02WARN
HTTP request
bytes_sent=68ip=192.168.1.45latency=410.5µsmethod=GETpath=/api/mouls/nonexistent/recordsstatus=404error="moul 'nonexistent' not found"
72026/08/19 11:17:08WARN
Request tracking channel full, dropping request
component=analyticspath=/api/events
82026/08/19 11:17:15WARN
Background job failed, scheduled for retry
error="dial tcp: lookup smtp.mailgun.org: no such host"jobID=job_01j7k8anextAttemptAt="2026-08-19 11:18:15"worker=SendEmail
92026/08/19 11:17:21ERROR
HTTP request
bytes_sent=112email=alex@example.comip=192.168.1.80latency=14.85msmethod=POSTpath=/api/mouls/orders/recordsstatus=500user_id=usr_01j7k9p2error="database locked (sqlite busy)"
102026/08/19 11:17:25ERROR
After-webhook execution failed
err="Post "https://webhook.site/test": context deadline exceeded"url=https://webhook.site/test
112026/08/19 11:17:30ERROR
Failed to start Litestream replication
err="credentials not set in environment (AWS_ACCESS_KEY_ID)"
122026/08/19 11:17:40INFO
Cleaned up old requests
count=42
132026/08/19 11:17:40INFO
Cleaned up old visits
count=15
142026/08/19 11:17:40INFO
Cleaned up expired revoked tokens
count=0
152026/08/19 11:17:55INFO
Stopping Litestream replication...
162026/08/19 11:17:55INFO
Server stopped gracefully
172026/08/19 11:18:02FATAL
Server failed to run
err="listen tcp :8090: bind: address already in use"
import { Logs, SERVER_LOGS } from '@moul-dev/ui';

export default function Example() {
  return (
    <Logs
      data={SERVER_LOGS}
      title="Mould Engine Server Logs"
      defaultSelectedKeys={['log-8']}
      maxHeight="400px"
    />
  );
}

Features

  • React Aria Table Foundation: Full ARIA grid accessibility, keyboard navigation (arrow keys, row selection), and accessible column headers.
  • Automatic Log Parsing: Pass raw multi-line strings (like server.log), JSON log lines, or structured LogItem[] objects.
  • Severity Level Filtering: Quick filter chips for All, Errors, Warnings, Info, and Debug with real-time event counters.
  • Live Search: Filter messages, timestamps, and structured key-value attributes instantly.
  • Key-Value Attribute Chips: Automatically detects and highlights attributes (e.g. status=200, latency="3.12ms", path="/api/...", error="...").
  • Interactive Inspector: Select any log entry to view structured metadata and copy the raw log line with one click.
  • Quick Operations: Includes Copy All, Export / Download, line-wrap toggle, and compact density mode.

Usage Examples

1. Using Raw Text (e.g. server.log)

You can pass a raw multi-line log string directly into the text prop:

import { Logs } from '@moul-dev/ui';

const rawLogs = `2026/08/19 11:16:49 INFO Starting mould engine server addr="http://localhost:8090" env="development" version="dev"
2026/08/19 11:16:52 INFO HTTP request bytes_sent=48 ip="127.0.0.1" latency="182.4µs" method="GET" path="/api/health" status=200
2026/08/19 11:17:21 ERRO HTTP request bytes_sent=112 email="alex@example.com" ip="192.168.1.80" latency="14.85ms" method="POST" path="/api/mouls/orders/records" status=500 user_id="usr_01j7k9p2" error="database locked (sqlite busy)"`;

export function RawLogExample() {
  return <Logs text={rawLogs} title="Server Console" />;
}

2. Compact Density Mode

Enable compact mode for dense log inspection:

<Logs data={SERVER_LOGS} compact />

3. Custom Log Parser Utility

You can also use the exported parseLogs and parseLogLine utilities independently:

import { parseLogs, parseLogLine } from '@moul-dev/ui';

const items = parseLogs(rawText);
console.log(items[0].attributes?.status); // 200

API Reference

Logs Props

PropTypeDefaultDescription
data(LogItem | string)[][]Array of log items or raw log lines.
textstring—Raw multi-line log string.
titleReact.ReactNode'Logs'Title displayed in the top toolbar.
showToolbarbooleantrueWhether to show the top filter and action toolbar.
showLineNumbersbooleantrueWhether to display row line numbers.
showTimestampsbooleantrueWhether to display the timestamp column.
showLevelsbooleantrueWhether to display severity level badges.
showAttributesbooleantrueWhether to render key-value chips in message cells.
showInspectorbooleantrueWhether to display the details inspector for selected rows.
compactbooleanfalseEnable compact table density.
wrapLinesbooleantrueWhether to wrap long log lines.
maxHeightstring | number—Maximum height with vertical scroll container.
selectionMode'none' | 'single' | 'multiple''single'React Aria row selection mode.
selectedKeys'all' | Iterable<Key>—Controlled selected row keys.
onSelectionChange(keys: 'all' | Set<Key>) => void—Selection change callback.
filterLevel'all' | 'info' | 'warn' | 'error' | 'debug' | 'trace''all'Controlled filter level.
searchQuerystring''Controlled search filter query.
onClear() => void—Callback fired when Clear button is clicked.
onDownload() => void—Callback fired when Export button is clicked.
onCopy(text: string) => void—Callback fired when copy button is clicked.

On this page