Skip to content

LogRegion

A scrolling log view that keeps the newest entry in view as entries arrive, with severity styling, filtering, and copy.

See also: MessageList for a conversation transcript.

Import: package:fleury/fleury.dart, or package:fleury/fleury_core.dart in browser code.

LogRegion(
entries: const [
LogEntry(id: 1, message: 'Starting deploy', source: 'deploy'),
LogEntry(
id: 2,
message: 'Health check failed: 503 on /ready',
severity: LogSeverity.error,
source: 'probe',
),
],
// Narrow what's shown without changing the entries:
filter: const LogRegionFilterDescriptor(severities: {LogSeverity.error}),
)

To stream output, keep the entries in your state, append each new LogEntry, and rebuild (with setState, for example); the region shows the new rows. If you also drop old entries from the front, give every entry a unique LogEntry.id so the cursor stays on its entry and LogRegionController.unseenCount stays accurate.

The region follows the tail by default, with the cursor on the newest entry. Scrolling up to read history pauses following, and LogRegionController.unseenCount counts the entries that arrive meanwhile. Scrolling back to the end, pressing End, or calling LogRegionController.scrollToBottom resumes it.

Up and Down move the cursor; PageUp, PageDown, and Home jump. Clicking a row moves the cursor to it. Ctrl+C copies the entry under the cursor (see copySelection and copyOptions). filter narrows the rows shown by text, source, or severity without changing entries.

ParameterTypeDefaultDescription
entries:List<LogEntry>requiredThe log rows, oldest first. To add rows, append to the list (or pass a new one) and rebuild.
controller:LogRegionController?—Reads and moves the cursor and controls tail following. If null, the region creates its own.
focusNode:FocusNode?—Focus node used for keyboard navigation.
autofocus:boolfalseWhether the region should request focus when mounted.
semanticLabel:String'Logs'Semantic label (the accessibility name; not rendered) for the region.
showPrefix:booltrueWhether each row starts with a [timestamp SEVERITY source] prefix, leaving out the parts an entry doesn’t have.
maxLineLength:int?1000Cuts each message to this many characters, with no ellipsis, on screen and when copied; null never cuts. The prefix doesn’t count.
filter:LogRegionFilterDescriptor?—Narrows the rows shown by text, source, or severity; entries is left unchanged.
searchIndex:LogRegionSearchIndex?—Optional prebuilt search index for large log collections. The region uses it only when it was built over the same list object passed as entries; otherwise it filters without it.
copySelection:booltrueWhether Ctrl+C (and the semantic copy action) copies the entry under the cursor.
copyOptions:LogRegionCopyOptionsconst LogRegionCopyOptions()Whether copied text includes the row prefix, and the clipboard write policy.
onCopy:void Function(LogRegionCopyResult result)?—Called after a copy attempt completes.

LogRegion is defined in packages/fleury/lib/src/catalog/log_region.dart.

Category: Agent surfaces · All widgets