logging

package
v1.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelCrit   = iota // 0 - Critical errors (fatal, app should stop)
	LevelError         // 1 - Errors (non-fatal but important)
	LevelWarn          // 2 - Warnings
	LevelNotice        // 3 - Important info (startup, shutdown, config)
	LevelInfo          // 4 - General info
	LevelDebug         // 5 - Debug details
)

Log levels

Variables

View Source
var (
	// Logger is the package-level logger used across the project.
	Logger = log.New(os.Stdout, "", 0) // We'll handle our own formatting
	// Level controls verbosity. Default to NOTICE for sane production defaults.
	Level      = LevelNotice
	UseColors  = true                  // Enable colors by default
	TimeFormat = "Jan 02 15:04:05.000" // Kyle's format: "Oct 14 13:16:37.788"
)

Functions

func Crit

func Crit(format string, v ...interface{})

Crit logs critical errors (application should stop)

func Debug

func Debug(format string, v ...interface{})

Debug logs very verbose diagnostic messages

func DisableColors

func DisableColors()

DisableColors disables color output

func Error

func Error(format string, v ...interface{})

Error logs error-level messages (non-fatal but important)

func GinLogger

func GinLogger() gin.HandlerFunc

GinLogger returns a gin.HandlerFunc middleware that logs requests using our logger

func GinRecovery

func GinRecovery() gin.HandlerFunc

GinRecovery returns a gin.HandlerFunc middleware that recovers from panics

func Info

func Info(format string, v ...interface{})

Info logs general informational messages

func Notice

func Notice(format string, v ...interface{})

Notice logs important informational messages (startup, config, shutdown)

func SetLevel

func SetLevel(l int)

SetLevel sets the logger verbosity level.

func SetOutput

func SetOutput(w io.Writer)

SetOutput sets the output destination for logs

func Warn

func Warn(format string, v ...interface{})

Warn logs warning-level messages

Types

This section is empty.

Jump to

Keyboard shortcuts

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