log

package
v0.62.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CensorFormatter

type CensorFormatter struct {
	CensorItems         []CensorItem
	UnderlyingFormatter log.Formatter
}

CensorFormatter makes sure sensitive data is not logged. It works as a middleware and sensors the data before sending it to an underlying formatter

func NewCensorFormatter added in v0.33.2

func NewCensorFormatter(underlyingFormatter log.Formatter, additionalCensoring ...CensorItem) *CensorFormatter

NewCensorFormatter creates a new formatter that censors sensitive logs. It contains some default censoring rules, but additional items may be used

func (*CensorFormatter) Format

func (f *CensorFormatter) Format(entry *log.Entry) ([]byte, error)

Format censors some data and sends the entry to the underlying formatter

type CensorItem

type CensorItem struct {
	Sensitive       string
	SensitiveRegexp *regexp.Regexp
	Replacement     string
}

CensorItem is something that should be censored, Sensitive will be replaced with Replacement

Jump to

Keyboard shortcuts

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