logging

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2025 License: EUPL-1.2 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Component

func Component(v any) slog.Attr

Component returns a slog attribute for a component type.

func Error

func Error(err error) slog.Attr

Error returns a slog attribute for errors.

func FHIRServer

func FHIRServer(url string) slog.Attr

FHIRServer returns a slog attribute for FHIR server URLs.

func Init

func Init()

Init initializes the global slog logger with JSON output and trace context injection. Default log level is Debug to match previous zerolog configuration.

func TypeOf

func TypeOf(key string, v any) slog.Attr

TypeOf returns a slog attribute with the type name of the given value.

Types

type ContextHandler

type ContextHandler struct {
	slog.Handler
}

ContextHandler wraps a slog.Handler and automatically adds trace context to log records. When a valid OpenTelemetry span is present in the context, trace_id and span_id are added.

func (*ContextHandler) Handle

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

Handle adds trace context attributes to the record before delegating to the wrapped handler.

func (*ContextHandler) WithAttrs

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

WithAttrs returns a new handler with the given attributes.

func (*ContextHandler) WithGroup

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

WithGroup returns a new handler with the given group name.

Jump to

Keyboard shortcuts

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