log

package
v3.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: MIT Imports: 6 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 writes the append-only audit trail, ported from util/log.audit. Each event is one JSON line: {ts, event, ...fields}. The log lives in the config home (not ~/.ssh), so it is outside the reconcile/render parity surface.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Audit

func Audit(auditLog, event string, fields ...Field)

Audit appends one JSON line to auditLog (best-effort: I/O errors are swallowed). The parent dir is created 0700 and a freshly created log is 0600.

func SetSink

func SetSink(fn func(Event)) func(Event)

SetSink registers fn to receive every event Audit records, once audit.log has been written (or failed to be), and returns the sink it replaced. nil removes it.

It exists so the history store can index the audit trail without this package importing it: util/log stays dependency-free, and the store registers itself from the command layer. The audit log is still written first and regardless, so a sink that fails loses nothing audit.log did not already have.

Types

type Event

type Event struct {
	AuditLog string
	TS       string
	Name     string
	Fields   []Field
	JSON     string // the whole line, without its newline
}

Event is one audit record as it was written: the timestamp, the event name, and the fields as the JSON object audit.log holds for them.

type Field

type Field struct {
	Key   string
	Value any
}

Field is one ordered key/value pair in an audit record. Order is preserved in the emitted JSON (the order v1 emitted them in).

Jump to

Keyboard shortcuts

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