Help us shape the future of Go! Take the 2026 Go Developer Survey

logging

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Level

type Level int

Level represents a logging level, identical to [slog.Level].

const (
	LevelDebug Level = -4
	LevelInfo  Level = 0
	LevelWarn  Level = 4
	LevelError Level = 8
	LevelNever Level = math.MaxInt
)

type Logger

type Logger interface {
	// Level returns the current logging level for this Logger.
	Level() Level

	// Logf logs a message with a logging level.
	Logf(level Level, format string, v ...any)

	// Debugf logs a message with level debug.
	Debugf(format string, v ...any)

	// Infof logs a message with level info.
	Infof(format string, v ...any)

	// Printf is an alias for Infof.
	Printf(format string, v ...any)

	// Warnf logs a message with level warn.
	Warnf(format string, v ...any)

	// Errorf logs a message with level error.
	Errorf(format string, v ...any)
}

Logger represents a simple logging interface.

func DiscardLogger

func DiscardLogger() Logger

DiscardLogger returns a logger that discards all output.

func NewLogger

func NewLogger(out io.Writer, level Level) Logger

NewLogger returns a new leveled logger that writes to out.

Jump to

Keyboard shortcuts

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