handler

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package handler holds the internal slog.Handler chain that backs the telemetry logger: trace correlation, redaction, and the zerolog writer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRedact

func NewRedact(next slog.Handler, r *redact.Redactor) slog.Handler

NewRedact wraps next so every attribute is redacted before reaching it.

func NewTrace

func NewTrace(next slog.Handler) slog.Handler

NewTrace wraps next so log records gain trace_id/span_id when the context carries a valid OpenTelemetry span.

Types

type ZerologHandler

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

ZerologHandler is a terminal slog.Handler that writes records via zerolog.

func NewZerolog

func NewZerolog(w io.Writer, level slog.Leveler, console bool) *ZerologHandler

NewZerolog builds a terminal handler. When console is true it renders human-friendly output, otherwise structured JSON.

func (*ZerologHandler) Enabled

func (h *ZerologHandler) Enabled(_ context.Context, l slog.Level) bool

func (*ZerologHandler) Handle

func (h *ZerologHandler) Handle(_ context.Context, rec slog.Record) error

func (*ZerologHandler) WithAttrs

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

func (*ZerologHandler) WithGroup

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

Source Files

  • redact.go
  • trace.go
  • zerolog.go

Jump to

Keyboard shortcuts

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