logging

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package logging configures gskill's structured logger. Logs always go to stderr (never stdout, which is reserved for primary command output), with the level and format taken from configuration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) *slog.Logger

New builds an slog.Logger from opts, defaulting the sink to stderr and the encoding to text.

func ParseLevel

func ParseLevel(name string) slog.Level

ParseLevel maps a case-insensitive level name ("debug", "info", "warn", "error") to an slog.Level, falling back to slog.LevelInfo for empty or unknown values.

Types

type Format

type Format string

Format selects the structured-log encoding.

const (
	FormatText Format = "text"
	FormatJSON Format = "json"
)

Supported log formats.

type Options

type Options struct {
	// Level is the minimum level emitted. The zero value is slog.LevelInfo.
	Level slog.Level
	// Format selects text or JSON encoding. The zero value is FormatText.
	Format Format
	// Writer is the log sink. The zero value is os.Stderr.
	Writer io.Writer
}

Options configures a logger built by New.

Jump to

Keyboard shortcuts

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