log

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(v ...any)

Debug logs a debug message.

func Debugf

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

Debugf logs a formatted debug message.

func Error

func Error(v ...any)

Error logs an error message.

func Errorf

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

Errorf logs a formatted error message.

func Fatal

func Fatal(v ...any)

Fatal logs a fatal message and exits.

func Fatalf

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

Fatalf logs a formatted fatal message and exits.

func Warn

func Warn(v ...any)

Warn logs a warn message.

func Warnf

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

Warnf logs a formatted warn message.

Types

type Level

type Level int

Level represents the severity of the log.

const (
	// DEBUG is the debug level.
	DEBUG Level = iota
	// WARN is the warning level.
	WARN
	// ERROR is the error level.
	ERROR
	// FATAL is the fatal level.
	FATAL
)

func (Level) Prefix

func (level Level) Prefix() (string, error)

Prefix returns the prefix string for the level.

type Logger

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

Logger is a wrapper around log.Logger.

func NewLogger

func NewLogger(l Level, w io.Writer) *Logger

NewLogger creates a new Logger.

func (*Logger) IsLevelEnabled

func (l *Logger) IsLevelEnabled(level Level) bool

IsLevelEnabled checks if the level is enabled.

func (*Logger) Log

func (l *Logger) Log(level Level, v ...any)

Log logs a message.

func (*Logger) Logf

func (l *Logger) Logf(level Level, format string, v ...any)

Logf logs a formatted message.

Jump to

Keyboard shortcuts

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