logtap

package
v0.2.1 Latest Latest
Warning

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

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

Documentation

Overview

Package logtap copies the records an App's loggers write to one more slog.Handler, the OpenTelemetry Logs bridge of telemetry, without a public API: the root package wraps the handlers it builds with Wrap, and App.Use binds telemetry's bridge to that App when logs.otel is on. Until then a wrapped handler costs an atomic load per record.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Install

func Install(owner, h slog.Handler) (uninstall func())

Install makes owner's group of wrapped handlers copy records to h, in place of the handler installed before. The returned function removes h unless another Install has replaced it since.

func Wrap

func Wrap(h slog.Handler) slog.Handler

Wrap returns a handler that writes through h and, while a handler is installed, passes the records h is enabled for to that one too, with the attributes and groups given to WithAttrs and WithGroup on the way.

Types

type Group

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

Group scopes one bridge to the handlers of one App.

func (*Group) Wrap

func (g *Group) Wrap(h slog.Handler) slog.Handler

Wrap shares this group's bridge with h.

Jump to

Keyboard shortcuts

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