Help us shape the future of Go! Take the 2026 Go Developer Survey

logger

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...Option) trace.Handler

New creates a new trace.Handler that logs trace events via slog. By default, all events are enabled. Use WithEvents to enable only specific events.

Types

type Event

type Event int

Event represents a trace event type that can be selectively enabled.

const (
	// AgentExec enables logging of agent execution start/end.
	AgentExec Event = iota
	// LLMRequest enables logging of LLM request details (system prompt, messages, tools).
	LLMRequest
	// LLMResponse enables logging of LLM response details (texts, function calls, token usage).
	LLMResponse
	// ToolExec enables logging of tool execution (name, args, result, duration).
	ToolExec
	// SubAgent enables logging of sub-agent start/end.
	SubAgent
	// ChildAgent enables logging of child agent start/end.
	ChildAgent
	// CustomEvent enables logging of strategy-defined custom events.
	CustomEvent
)

type Option

type Option func(*config)

Option configures the logger handler.

func WithEvents

func WithEvents(events ...Event) Option

WithEvents enables only the specified event types. When not specified, all events are enabled.

func WithLogger

func WithLogger(l *slog.Logger) Option

WithLogger sets a custom slog.Logger. Default is a discard logger.

Jump to

Keyboard shortcuts

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