logging

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package logging provides the bracket log handler for llm-router: [LEVEL][dd.mm.yyyy h:m:s.ms][key: value] message.

Index

Constants

View Source
const TimeFormat = "02.01.2006 15:04:05.000"

TimeFormat renders record timestamps as dd.mm.yyyy h:m:s.ms.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler formats records as bracket groups. Each attribute renders as its own [key: value] group in call order. Groups flatten with dot separators.

func NewHandler

func NewHandler(w io.Writer, level slog.Level) *Handler

NewHandler builds a Handler writing to w at level.

func (*Handler) Enabled

func (h *Handler) Enabled(_ context.Context, level slog.Level) bool

Enabled reports whether level passes the configured threshold.

func (*Handler) Handle

func (h *Handler) Handle(_ context.Context, r slog.Record) error

Handle renders one record in bracket format.

func (*Handler) WithAttrs

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

WithAttrs returns a Handler with attrs appended, qualified by groups.

func (*Handler) WithGroup

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

WithGroup returns a Handler scoping subsequent attrs under name.

Jump to

Keyboard shortcuts

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