logger

package
v1.0.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

Package-level delegations

func Debugf

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

func Error

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

func Errorf

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

func Info

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

func Infof

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

func SetDefault

func SetDefault(l *Logger)

SetDefault sets global default logger.

func Warn

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

func Warnf

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

Types

type Level

type Level int

Level defines log severity.

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
)

func (Level) String

func (l Level) String() string

type Logger

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

Logger is a structured concurrency-safe logger.

func GetDefault

func GetDefault() *Logger

GetDefault returns the global default logger.

func New

func New(out io.Writer, minLevel Level, jsonMode bool, noColor bool) *Logger

New creates a new Logger instance.

func (*Logger) Debug

func (l *Logger) Debug(msg string, keyvals ...any)

Debug logs at debug level.

func (*Logger) Error

func (l *Logger) Error(msg string, keyvals ...any)

Error logs at error level.

func (*Logger) Info

func (l *Logger) Info(msg string, keyvals ...any)

Info logs at info level.

func (*Logger) SetJSONMode

func (l *Logger) SetJSONMode(enable bool)

SetJSONMode toggles JSON logging.

func (*Logger) SetLevel

func (l *Logger) SetLevel(lvl Level)

SetLevel updates log level.

func (*Logger) Warn

func (l *Logger) Warn(msg string, keyvals ...any)

Warn logs at warning level.

Jump to

Keyboard shortcuts

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