Help us shape the future of Go! Take the 2026 Go Developer Survey

logger

package
v1.41.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLogger

func GetLogger() *slog.Logger

GetLogger returns the default slog logger

func Init

func Init(level slog.Level, output *os.File, format string)

Init initializes the logger with the specified level and format Third-party library logs are only shown when level is DEBUG Color support is enabled automatically for terminal output format: "simple" (level + message only), "verbose" (time + level + message + attributes),

or any custom value (falls back to default slog.TextHandler format)

func OpenLogFile

func OpenLogFile(path string) (*os.File, func(), error)

OpenLogFile opens or creates a log file at the specified path Returns the file handle and a cleanup function, or an error

func ParseLevel

func ParseLevel(levelStr string) (slog.Level, error)

ParseLevel converts a string log level to slog.Level Valid levels: debug, info, warn, error

Types

This section is empty.

Jump to

Keyboard shortcuts

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