Skip to main content

Module log_viewer

Module log_viewer 

Source
Expand description

A scrolling log viewer widget optimized for streaming append-only content.

LogViewer is THE essential widget for agent harness UIs. It displays streaming logs with scrollback while maintaining UI chrome and handles:

  • High-frequency log line additions without flicker
  • Auto-scroll behavior for “follow” mode
  • Manual scrolling to inspect history
  • Memory bounds via circular buffer eviction
  • Substring filtering for log lines
  • Text search with next/prev match navigation

§Architecture

LogViewer delegates storage and scroll state to Virtualized<Text>, gaining momentum scrolling, overscan, and page navigation for free. LogViewer adds capacity management (eviction), wrapping, filtering, and search on top.

§Example

use ftui_widgets::log_viewer::{LogViewer, LogViewerState, LogWrapMode};
use ftui_text::Text;

// Create a viewer with 10,000 line capacity
let mut viewer = LogViewer::new(10_000);

// Push log lines (styled or plain)
viewer.push("Starting process...");
viewer.push(Text::styled("ERROR: failed", Style::new().fg(Color::Red)));

// Render with state
let mut state = LogViewerState::default();
viewer.render(area, frame, &mut state);

Structs§

FilterStats
Statistics tracking incremental vs full-rescan filter/search operations.
LogViewer
A scrolling log viewer optimized for streaming append-only content.
LogViewerState
Separate state for StatefulWidget pattern.
SearchConfig
Search configuration.

Enums§

LogWrapMode
Line wrapping mode for log lines.
SearchMode
Search mode for log search.