logging

package
v2.4.6 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package logging installs the process-wide slog handler with a runtime-changeable level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Level

func Level() slog.Level

Level reports the level currently in effect.

func LevelName

func LevelName(l slog.Level) string

LevelName renders a level the way ParseLevel accepts it.

func ParseLevel

func ParseLevel(s string) slog.Level

ParseLevel maps a level name (case-insensitive) to a slog.Level, defaulting to info.

func SetLevel

func SetLevel(l slog.Level)

SetLevel changes the level for the remaining lifetime of the process and cancels any pending auto-revert.

func SetLevelFor

func SetLevelFor(l slog.Level, ttl time.Duration)

SetLevelFor changes the level for ttl, then restores the previous level. ttl <= 0 is treated as a permanent SetLevel.

func Setup

func Setup(service string)

Setup installs a JSON handler on stdout tagged with the service name. Initial level comes from LOG_LEVEL; unrecognised or empty values select info.

func String

func String() string

String renders the active level name.

func Var

func Var() *slog.LevelVar

Var exposes the LevelVar for a handler built outside Setup (tests, tooling).

Types

This section is empty.

Jump to

Keyboard shortcuts

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