log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(
	ctx context.Context,
) ([]string, error)

ListSources returns unique syslog identifiers from the journal.

func (*Debian) Query

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

Query returns journal entries with optional filtering.

func (*Debian) QueryUnit

func (d *Debian) QueryUnit(
	ctx 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