Help us shape the future of Go! Take the 2026 Go Developer Survey

logging

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logging configures structured logging with secret redaction.

Index

Constants

View Source
const LevelTrace = slog.Level(-8)

LevelTrace is more verbose than debug.

Variables

This section is empty.

Functions

func Discard

func Discard() *slog.Logger

Discard returns a logger that drops everything.

func IsSensitiveKey

func IsSensitiveKey(k string) bool

IsSensitiveKey reports whether an attribute key names secret data.

func New

func New(w io.Writer, level slog.Level) *slog.Logger

New returns a logger writing text records to w at level.

func ParseLevel

func ParseLevel(s string) (slog.Level, bool)

ParseLevel maps error|warn|info|debug|trace to a slog level.

Types

type Secret

type Secret string

Secret wraps a value so that it is never logged.

func (Secret) LogValue

func (Secret) LogValue() slog.Value

LogValue implements slog.LogValuer.

func (Secret) String

func (Secret) String() string

String prevents accidental formatting of the secret with %s/%v.

Jump to

Keyboard shortcuts

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