logger

package
v1.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2024 License: BSD-2-Clause Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

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

Debug calls the default logger's Debug method.

func Error

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

Error calls the default logger's Error method.

func Info

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

Info calls the default logger's Info method.

func SetDefaultLogger

func SetDefaultLogger(l Logger)

SetDefaultLogger sets the default logger. This is not concurrency safe, which means it should only be called during init.

func SetLevel

func SetLevel(lv Level)

SetLevel sets the level of logs below which logs will not be output. The default log level is LevelDebug.

func Warn

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

Warn calls the default logger's Warn method.

Types

type Level

type Level int

Level defines the priority of a log message. When a logger is configured with a level, any log message with a lower log level (smaller by integer comparison) will not be output.

const (
	LevelDebug Level = iota
	LevelInfo
	LevelWarn
	LevelError
)

The levels of logs.

func (Level) String

func (lv Level) String() string

String implementation.

type Logger

type Logger interface {
	Debug(format string, v ...any)
	Info(format string, v ...any)
	Warn(format string, v ...any)
	Error(format string, v ...any)
}

Logger is a logger anyhat provides logging function with levels.

Jump to

Keyboard shortcuts

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