logreduct

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2026 License: MIT Imports: 6 Imported by: ? 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 logreduct masks registered secrets in log text and slog attributes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Redactor

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

Redactor tracks secrets and their reference counts for log masking. The zero value is ready to use. A Redactor is safe for concurrent use and must not be copied after first use.

var Default Redactor

Default is a shared redactor for process-wide logging. Handlers using its ReplaceAttr method see secrets registered after the handler was configured.

func (*Redactor) Add

func (s *Redactor) Add(value string)

Add registers a secret and its nonblank lines for masking.

func (*Redactor) AddJIT

func (s *Redactor) AddJIT(value string) []string

AddJIT registers an encoded GitHub Actions JIT configuration and any decoded content and credential fields. Pass the returned values to Release after use.

func (*Redactor) Redact

func (s *Redactor) Redact(value string) string

Redact replaces registered secrets with "***", merging overlapping matches.

func (*Redactor) Release

func (s *Redactor) Release(values []string)

Release drops one registration of each value and its nonblank lines. A secret remains masked until all of its registrations have been released.

func (*Redactor) ReplaceAttr

func (s *Redactor) ReplaceAttr(_ []string, attr slog.Attr) slog.Attr

ReplaceAttr masks strings and errors, including nested groups, for use with slog.HandlerOptions.ReplaceAttr.

Jump to

Keyboard shortcuts

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