logger

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CensorTextWithRegex added in v0.1.4

func CensorTextWithRegex(text string, forbiddenPhrases ...CensorRegexRedactor) string

CensorTextWithRegex Returns text with censored phrases. Additional phrases that should be hidden in text might be added as param 'forbiddenPhrases'. If param 'forbiddenPhrases' is not set then only default forbidden phrases are taken into account

func Debug

func Debug(msg string, args ...any)

func Error

func Error(msg string, args ...any)

func Info

func Info(msg string, args ...any)

func NewCustomHandler

func NewCustomHandler(writer io.Writer, opts *slog.HandlerOptions) slog.Handler

NewCustomHandler creates a new instance of CustomHandler

func NewCustomLogger

func NewCustomLogger(w io.Writer) *slog.Logger

func Warn

func Warn(msg string, args ...any)

Types

type CensorRegexRedactor added in v0.1.4

type CensorRegexRedactor struct {
	Regex  string
	Prefix string
	Suffix string
}

type CustomHandler

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

CustomHandler implements the slog.Handler interface

func (*CustomHandler) Enabled

func (h *CustomHandler) Enabled(ctx context.Context, level slog.Level) bool

Enabled checks if a log level is enabled

func (*CustomHandler) Handle

func (h *CustomHandler) Handle(ctx context.Context, r slog.Record) error

Handle writes log records in the desired format

func (*CustomHandler) WithAttrs

func (h *CustomHandler) WithAttrs(attrs []slog.Attr) slog.Handler

WithAttrs returns a new handler with additional attributes (not used here)

func (*CustomHandler) WithGroup

func (h *CustomHandler) WithGroup(name string) slog.Handler

WithGroup returns a new handler with a specified group (not used here)

Jump to

Keyboard shortcuts

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