log

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 16, 2023 License: MIT Imports: 3 Imported by: 81 modules, 79 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

View Source
const LevelKey = "level"

LevelKey is logger level key.

Variables

View Source
var DefaultLogger = NewStdLogger(log.Writer())

DefaultLogger is default logger.

Functions

func Debug

func Debug(v ...any)

Debug log

func Debugf

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

Debugf log

func Error

func Error(v ...any)

Error log

func Errorf

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

Errorf log

func Info

func Info(v ...any)

Info log

func Infof

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

Infof log

func SetLogger

func SetLogger(log Logger)

SetLogger set logger

func Warn

func Warn(v ...any)

Warn log

func Warnf

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

Warnf log

Types

type Level

type Level int8

Level is a logger level.

const (
	// LevelDebug is logger debug level.
	LevelDebug Level = iota
	// LevelInfo is logger info level.
	LevelInfo
	// LevelWarn is logger warn level.
	LevelWarn
	// LevelError is logger error level.
	LevelError
)

func ParseLevel

func ParseLevel(s string) Level

ParseLevel parses a level string into a logger Level value.

func (Level) String

func (l Level) String() string

type Logger

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

Logger logger interface

func GetLogger

func GetLogger() Logger

GetLogger get logger

func NewStdLogger

func NewStdLogger(w io.Writer) Logger

NewStdLogger new a logger with writer.

Jump to

Keyboard shortcuts

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