logger

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NullLogger = nullLogger{}

NullLogger is a logger that does nothing

Functions

func Debugf

func Debugf(format string, v ...interface{})

Debugf records something in the debug log

func MockLogger

func MockLogger(prefix string) (buf *bytes.Buffer, restore func())

MockLogger replaces the existing logger with a buffer and returns the log buffer and a restore function.

func Noticef

func Noticef(format string, v ...interface{})

Noticef notifies the user of something

func Panicf

func Panicf(format string, v ...interface{})

Panicf notifies the user and then panics

Types

type Logger

type Logger interface {
	// Notice is for messages that the user should see
	Notice(msg string)
	// Debug is for messages that the user should be able to find if they're debugging something
	Debug(msg string)
}

A Logger is a fairly minimal logging tool.

func New

func New(w io.Writer, prefix string) Logger

New creates a log.Logger using the given io.Writer and prefix (which is printed between the timestamp and the message).

func SetLogger

func SetLogger(l Logger) (old Logger)

SetLogger sets the global logger to the given one. It must be called from a single goroutine before any logs are written.

Jump to

Keyboard shortcuts

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