log

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package log is the cross-cutting redaction logger. Plugins and core code MUST route all informational/diagnostic output through this logger; direct writes to os.Stdout / os.Stderr from plugin code are forbidden. The logger strips emails, ARNs, UUIDs, access key IDs, JWTs, and configured secret shapes at the write boundary, so CI log capture cannot exfiltrate identifiers even in --verbose mode.

See docs/architecture/02-layers.md §Logging and redaction.

Package log provides a minimal redaction-aware logger for the CLI. Plugins and core code MUST route diagnostic output through this logger so known PII shapes (emails, ARNs, UUIDs in identifier position, AWS access key IDs, JWTs) are stripped before they reach CI log storage. See docs/architecture/02-layers.md §Logging and redaction.

The redaction patterns are deliberately conservative — they match canonical formats, not heuristic shapes. False negatives are preferable to false positives at this layer; the structural privacy boundary at L6 is the load-bearing guarantee.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Redact

func Redact(s string) string

Redact replaces canonical PII shapes in s with <redacted:type> tags. Used by Logger.log; exposed for callers that need to redact strings before storing them in structured fields elsewhere.

Types

type Level

type Level int

Level orders log severities from least to most urgent.

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
)

Level values.

type Logger

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

Logger emits redacted records to its sink. Construct via New. The zero value is not usable; New always returns a fully-initialized logger.

func Default

func Default() *Logger

Default returns a logger writing to os.Stderr in non-verbose mode. Used by callers that don't need fine control.

func New

func New(sink io.Writer, verbose bool) *Logger

New returns a logger writing to sink. If verbose is true, Debug records are emitted; otherwise Debug is suppressed. Redaction is always on — no flag disables it.

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...any)

Debugf records at LevelDebug; suppressed unless the logger is verbose.

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...any)

Errorf records at LevelError.

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...any)

Infof records at LevelInfo.

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...any)

Warnf records at LevelWarn.

Jump to

Keyboard shortcuts

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