logger

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

func Debugf(format string, args ...any)

func Errorf

func Errorf(format string, args ...any)

func Fatalf

func Fatalf(format string, args ...any)

func GinLogger

func GinLogger() gin.HandlerFunc

GinLogger returns a gin.HandlerFunc that logs HTTP requests using the unified logger.

func Infof

func Infof(format string, args ...any)

func Init

func Init()

Init configures the global logger from environment variables. Reads NO_COLOR (any value disables colors) and LOG_LEVEL (debug/info/warn/error/fatal).

func SetLevel

func SetLevel(l Level)

SetLevel changes the minimum log level at runtime.

func Warnf

func Warnf(format string, args ...any)

Types

type Level

type Level int

Level represents a log severity level.

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
	LevelFatal
)

func GetLevel

func GetLevel() Level

GetLevel returns the current minimum log level.

func (Level) String

func (l Level) String() string

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger provides leveled, scoped, colored logging.

func WithScope

func WithScope(scope string) *Logger

WithScope returns a Logger that prefixes all messages with [scope].

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...any)

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...any)

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...any)

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...any)

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...any)

Jump to

Keyboard shortcuts

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