logging

package
v0.5.0-beta Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: MIT Imports: 7 Imported by: 0 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 provides structured logging using slog.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, args ...any)

Debug logs at debug level.

func Error

func Error(msg string, args ...any)

Error logs at error level.

func Info

func Info(msg string, args ...any)

Info logs at info level.

func Setup

func Setup(level string, json bool, fc *FileConfig)

Setup initializes the global logger. Logs are always written to stdout. When fc is non-nil and fc.Path is set, logs are additionally written to a rotating file via lumberjack.

func Warn

func Warn(msg string, args ...any)

Warn logs at warn level.

Types

type FileConfig

type FileConfig struct {
	Path       string // log file path
	MaxSizeMB  int    // max size per file in MB
	MaxBackups int    // max number of old log files to keep
}

FileConfig holds log file rotation settings.

Jump to

Keyboard shortcuts

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