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

logging

package
v0.0.90 Latest Latest
Warning

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

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

Documentation

Overview

Package logging configures selective structured logging using standard slog loggers. It does not change process globals, read environment variables, or depend on C2J's workflow runtime. Applications own the logger and its output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(output io.Writer, opts Options) (*slog.Logger, error)

New constructs a logger; nil output means stderr. All routes share one output handler, and first-match routing prevents duplicate records. Redaction, where required, must wrap this logger before deriving child loggers.

func ParseLevel

func ParseLevel(value string) (slog.Level, error)

ParseLevel accepts the four supported CLI levels, case-insensitively.

Types

type Options

type Options struct {
	Level  slog.Leveler
	Format string
	Debug  []Selector
}

Options configures an output handler. Defaults are INFO and text. Level may be a *slog.LevelVar owned and updated by the host.

type Selector

type Selector struct {
	Field string
	Value string
}

Selector enables DEBUG and above for an exact top-level string attribute. Multiple selectors are ORed; ordinary baseline records always remain visible.

func ParseSelector

func ParseSelector(value string) (Selector, error)

ParseSelector parses one field=value selection, splitting at the first '='.

Jump to

Keyboard shortcuts

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