eventlog

package
v0.7.161 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapFromDir

func WrapFromDir(dataDir string, fn iostream.StatusFunc, op Op, sidecarID, sidecarName, branch string) iostream.StatusFunc

WrapFromDir wraps fn with event-log appending using the log in dataDir. Errors opening the log are silently ignored (best-effort; never blocks).

Types

type Event

type Event struct {
	Ts          time.Time `json:"ts"`
	SidecarID   string    `json:"sidecar_id,omitempty"`
	SidecarName string    `json:"sidecar_name,omitempty"`
	Branch      string    `json:"branch,omitempty"`
	Op          Op        `json:"op"`
	Level       string    `json:"level"` // "step", "info", "warn", "done", "error"
	Msg         string    `json:"msg"`
}

Event is a single status event written to the log.

type Log

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

Log appends events to a JSONL file in a project data directory.

func Open

func Open(dataDir string) (*Log, error)

Open opens (or creates) the event log in dataDir, trimming if too large.

func (*Log) Append

func (l *Log) Append(e Event) error

Append writes a single event to the log.

func (*Log) Recent

func (l *Log) Recent(n int) ([]Event, error)

Recent returns up to n most recent events from the log.

func (*Log) TailFrom

func (l *Log) TailFrom(offset int64) ([]Event, int64, error)

TailFrom returns events appended after offset, and the updated offset.

func (*Log) Wrap

func (l *Log) Wrap(inner iostream.StatusFunc, op Op, sidecarID, sidecarName, branch string) iostream.StatusFunc

Wrap returns a StatusFunc that calls inner and also appends each call to the log. All events will be tagged with op, sidecarID, sidecarName, and branch.

type Op

type Op string

Op identifies the kind of operation that generated an event.

const (
	OpSync     Op = "sync"
	OpValidate Op = "validate"
	OpExec     Op = "exec"
	OpSetup    Op = "setup"
	OpHook     Op = "hook"
)

Op values for each sidecar operation type.

Jump to

Keyboard shortcuts

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