log

package
v0.0.0-...-443440a Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package log provides log viewing operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Darwin

type Darwin struct{}

Darwin implements the Provider interface for Darwin (macOS). All methods return ErrUnsupported as log management is not available on macOS.

func NewDarwinProvider

func NewDarwinProvider() *Darwin

NewDarwinProvider factory to create a new Darwin instance.

func (*Darwin) ListSources

func (d *Darwin) ListSources(
	_ context.Context,
) ([]string, error)

ListSources returns ErrUnsupported on Darwin.

func (*Darwin) Query

func (d *Darwin) Query(
	_ context.Context,
	_ QueryOpts,
) ([]Entry, error)

Query returns ErrUnsupported on Darwin.

func (*Darwin) QueryUnit

func (d *Darwin) QueryUnit(
	_ context.Context,
	_ string,
	_ QueryOpts,
) ([]Entry, error)

QueryUnit returns ErrUnsupported on Darwin.

type Debian

type Debian struct {
	provider.FactsAware
	// contains filtered or unexported fields
}

Debian implements the Provider interface for Debian-family systems using journalctl for log querying.

func NewDebianProvider

func NewDebianProvider(
	logger *slog.Logger,
	execManager exec.Manager,
) *Debian

NewDebianProvider factory to create a new Debian instance.

func (*Debian) ListSources

func (d *Debian) ListSources(
	_ context.Context,
) ([]string, error)

ListSources returns unique syslog identifiers from the journal.

func (*Debian) Query

func (d *Debian) Query(
	_ context.Context,
	opts QueryOpts,
) ([]Entry, error)

Query returns journal entries with optional filtering.

func (*Debian) QueryUnit

func (d *Debian) QueryUnit(
	_ context.Context,
	unit string,
	opts QueryOpts,
) ([]Entry, error)

QueryUnit returns journal entries for a specific systemd unit.

type Entry

type Entry struct {
	Timestamp string `json:"timestamp"`
	Unit      string `json:"unit,omitempty"`
	Priority  string `json:"priority"`
	Message   string `json:"message"`
	PID       int    `json:"pid,omitempty"`
	Hostname  string `json:"hostname,omitempty"`
}

Entry represents a single journal entry.

type Linux

type Linux struct{}

Linux implements the Provider interface for generic Linux. All methods return ErrUnsupported as this is a generic Linux stub.

func NewLinuxProvider

func NewLinuxProvider() *Linux

NewLinuxProvider factory to create a new Linux instance.

func (*Linux) ListSources

func (l *Linux) ListSources(
	_ context.Context,
) ([]string, error)

ListSources returns ErrUnsupported on generic Linux.

func (*Linux) Query

func (l *Linux) Query(
	_ context.Context,
	_ QueryOpts,
) ([]Entry, error)

Query returns ErrUnsupported on generic Linux.

func (*Linux) QueryUnit

func (l *Linux) QueryUnit(
	_ context.Context,
	_ string,
	_ QueryOpts,
) ([]Entry, error)

QueryUnit returns ErrUnsupported on generic Linux.

type Provider

type Provider interface {
	// Query returns journal entries with optional filtering.
	Query(ctx context.Context, opts QueryOpts) ([]Entry, error)
	// QueryUnit returns journal entries for a specific systemd unit.
	QueryUnit(ctx context.Context, unit string, opts QueryOpts) ([]Entry, error)
	// ListSources returns unique syslog identifiers from the journal.
	ListSources(ctx context.Context) ([]string, error)
}

Provider implements log viewing operations.

type QueryOpts

type QueryOpts struct {
	Lines    int    `json:"lines,omitempty"`
	Since    string `json:"since,omitempty"`
	Priority string `json:"priority,omitempty"`
}

QueryOpts contains optional filters for log queries.

Directories

Path Synopsis
Package mocks provides mock implementations for testing.
Package mocks provides mock implementations for testing.

Jump to

Keyboard shortcuts

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