logging

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package logging configures the standard library's structured slog logger.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(cfg Config) *slog.Logger

New creates a text or JSON slog logger. Output defaults to stderr.

func ParseLevel

func ParseLevel(value string) slog.Level

ParseLevel converts a common level name to slog.Level and defaults to info.

Types

type Config

type Config struct {
	Level     slog.Level
	Format    Format
	AddSource bool
	Output    io.Writer
}

Config configures a slog logger suitable for AstraEngine.

type Format

type Format string

Format selects the structured log encoding.

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

func ParseFormat

func ParseFormat(value string) Format

ParseFormat converts a format name to Format and defaults to text.

Jump to

Keyboard shortcuts

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