logpanel

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 9 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{}

LogLineMsg signals the TUI to re-render after new log output.

type Model

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

Model is a Bubble Tea model that displays log lines in a bordered panel.

func New

func New(t theme.Theme) Model

New creates a new log panel model.

func (Model) BorderView

func (m Model) BorderView(width, height int) string

BorderView renders the panel with its own border.

func (Model) Buffer

func (m Model) Buffer() *buffer

Buffer returns the underlying buffer pointer (for sharing with Writer).

func (Model) Focused

func (m Model) Focused() bool

Focused returns whether the panel is focused.

func (*Model) NewLogger

func (m *Model) NewLogger(w *Writer) *log.Logger

NewLogger returns a charmbracelet/log Logger that writes styled output into this panel's buffer. Pass the returned logger to log.SetDefault or use it directly so all log calls are captured and rendered with theme-derived colors.

func (*Model) SetFocused

func (m *Model) SetFocused(f bool)

SetFocused sets focus state.

func (*Model) SetSize

func (m *Model) SetSize(w, h int)

SetSize sets the available width and height for the panel content.

func (*Model) SetTheme

func (m *Model) SetTheme(t theme.Theme) *log.Styles

SetTheme updates the panel theme and returns matching logger styles.

func (Model) Update

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

Update handles key messages when focused.

func (Model) View

func (m Model) View() string

View renders the log panel content (no border).

func (Model) Wrap

func (m Model) Wrap() bool

Wrap returns whether line wrapping is enabled.

type Styles

type Styles struct {
	Levels map[log.Level]lipgloss.Style
}

func NewStyles

func NewStyles(t theme.Theme) *Styles

NewStyles creates log level badge styles derived from the active theme.

type Writer

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

Writer implements io.Writer and feeds log output into a shared buffer.

func NewWriter

func NewWriter(m *Model) *Writer

NewWriter creates a Writer that appends to the given Model's buffer.

func (*Writer) SetProgram

func (w *Writer) SetProgram(p *tea.Program)

SetProgram sets the tea.Program used to send re-render messages.

func (*Writer) Write

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

Write implements io.Writer.

Jump to

Keyboard shortcuts

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