logutil

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 5 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 logutil provides helpers for logging

Index

Constants

View Source
const (
	LevelTrace  slog.Level = -8
	LevelDebug             = slog.LevelDebug
	LevelInfo              = slog.LevelInfo
	LevelWarn              = slog.LevelWarn
	LevelError             = slog.LevelError
	LevelSilent slog.Level = 12
)

Add a lower Silent level and higher Trace level to the standard slog levels.

Variables

This section is empty.

Functions

func AsLevel

func AsLevel(level any) slog.Level

AsLevel parses the given level value and returns the corresponding slog.Level. It supports slog.Level, int, and string types. If the input is not recognized, it defaults to LevelSilent.

func GetLevel

func GetLevel() slog.Level

GetLevel returns the current logging level.

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the current logger.

func SetLevel

func SetLevel(level any)

SetLevel sets the logging level.

func UpdateLevel

func UpdateLevel(level string) error

UpdateLevel updates the logging level based on the provided string. It is used as a callback in pflags BoolFuncP which is why it returns an error even though the returned value is always nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

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