log

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2026 License: MIT Imports: 8 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...any)

func Debugf

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

func Error

func Error(args ...any)

func Errorf

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

func Fatal

func Fatal(args ...any)

func Fatalf

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

func Info

func Info(args ...any)

func Infof

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

func SetVerbose

func SetVerbose()

func Warn

func Warn(args ...any)

func Warnf

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

Types

type Base added in v0.5.0

type Base interface {
	Log(callerSkip int, lvl Level, msg string)
}

Base is the interface that underlies the Logger. It receives the caller skip count, log level, and formatted message.

type Level added in v0.5.0

type Level int32

Level defines all the available levels we can log at.

const (
	// DebugLevel is the lowest level of logging.
	// Debug logs are intended for debugging and development purposes.
	DebugLevel Level = iota + 1

	// InfoLevel is used for user-facing progress and status messages.
	InfoLevel

	// WarnLevel is used for undesired but relatively expected events,
	// which may indicate a problem.
	WarnLevel

	// ErrorLevel is used for undesired and unexpected events that
	// the program can recover from.
	ErrorLevel

	// FatalLevel is used for undesired and unexpected events that
	// the program cannot recover from.
	FatalLevel
)

func (Level) String added in v0.5.0

func (l Level) String() string

type Logger added in v0.5.0

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

Logger logs messages to io.Writer at various log levels.

func NewLogger added in v0.5.0

func NewLogger(base Base) *Logger

NewLogger creates and returns a new instance of Logger. Default level is InfoLevel (Debug messages are suppressed unless SetVerbose is called).

func (*Logger) Debug added in v0.5.0

func (l *Logger) Debug(args ...any)

func (*Logger) Debugf added in v0.5.0

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

func (*Logger) Error added in v0.5.0

func (l *Logger) Error(args ...any)

func (*Logger) Errorf added in v0.5.0

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

func (*Logger) Fatal added in v0.5.0

func (l *Logger) Fatal(args ...any)

func (*Logger) Fatalf added in v0.5.0

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

func (*Logger) Info added in v0.5.0

func (l *Logger) Info(args ...any)

func (*Logger) Infof added in v0.5.0

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

func (*Logger) SetLevel added in v0.5.0

func (l *Logger) SetLevel(v Level)

SetLevel sets the logger level. It panics if v is less than DebugLevel or greater than FatalLevel.

func (*Logger) Warn added in v0.5.0

func (l *Logger) Warn(args ...any)

func (*Logger) Warnf added in v0.5.0

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