logviewer

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LogLineMsg

type LogLineMsg struct {
	Workspace string
	Line      string
	NoPrefix  bool // If true, formatLogLine will not add a workspace prefix
}

LogLineMsg is sent when a new log line is received.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is the TUI component for viewing logs.

func New

func New(width, height int) Model

New creates a new log viewer model.

func (*Model) Clear

func (m *Model) Clear()

Clear stops tailing and clears the viewer's content.

func (*Model) GetScrollInfo

func (m *Model) GetScrollInfo() (currentLine, totalLines int)

GetScrollInfo returns current scroll position information.

func (*Model) GetScrollPercent

func (m *Model) GetScrollPercent() float64

GetScrollPercent returns the scroll position as a percentage.

func (*Model) GotoBottom

func (m *Model) GotoBottom()

GotoBottom scrolls to the bottom of the log content.

func (*Model) GotoTop

func (m *Model) GotoTop()

GotoTop scrolls to the top of the log content.

func (Model) Init

func (m Model) Init() tea.Cmd

Init initializes the component.

func (Model) IsFollowing

func (m Model) IsFollowing() bool

IsFollowing returns whether the log viewer is in follow mode.

func (*Model) SetContent

func (m *Model) SetContent(content string)

SetContent displays static content, stopping any live tailing.

func (*Model) Start

func (m *Model) Start(files map[string]string) tea.Cmd

Start begins tailing the specified log files.

func (*Model) Stop

func (m *Model) Stop()

Stop halts all tailing operations.

func (Model) Update

func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)

Update handles messages.

func (Model) View

func (m Model) View() string

View renders the log viewer with scrollbar.

type StreamWriter

type StreamWriter struct {
	NoWorkspacePrefix bool // If true, LogLineMsg will have NoPrefix set
	// contains filtered or unexported fields
}

StreamWriter implements io.Writer and sends complete log lines as messages to a TUI program. It buffers partial lines until a newline is encountered, ensuring that log lines are not split in the middle when streaming output.

func NewStreamWriter

func NewStreamWriter(program *tea.Program, workspace string) *StreamWriter

NewStreamWriter creates a new StreamWriter that sends log lines to the given TUI program. The workspace parameter is used to tag log lines with their source.

func (*StreamWriter) Write

func (w *StreamWriter) Write(p []byte) (n int, err error)

Write implements io.Writer. It buffers incoming data and sends complete lines (terminated by newline) as LogLineMsg to the TUI program.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL