audit

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package audit is the append-only record of what this tool did.

A kill switch is answerable afterwards: someone will ask which resources were touched, when, by whom, and whether the thing that is still broken was broken by this. One JSON object per line, never rewritten.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Log

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

Log is the append-only record of what this tool was asked to do and what it did. It is the answer to "who stopped production", so every event carries who and when and nothing can overwrite them.

func Discard

func Discard() *Log

Discard is the log for a run with nowhere to write: events are formed and dropped, so a failed open never changes the caller's control flow.

func New

func New(path string) (*Log, error)

New opens an append-only log. A log that cannot be opened is not fatal — an unwritable audit file must not be the reason a cost incident goes unhandled — but it is reported by the caller.

func To

func To(w io.Writer) *Log

To logs to an arbitrary writer, which is how a test reads what was recorded without going through a file.

func (*Log) Event

func (l *Log) Event(kind string, fields map[string]any)

Event appends one JSON record. A nil Log is usable and writes nothing, so no caller has to check before logging.

Jump to

Keyboard shortcuts

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