log

package
v0.44.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 6 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

This section is empty.

Variables

This section is empty.

Functions

func Debugf

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

Debugf 调试

func Errorf

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

Errorf 错误

func Fatalf

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

Fatalf 致命

func InLevel

func InLevel(levels []Level, level Level) bool

InLevel 是否在指定Level里

func Infof

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

Infof 信息

func Tracef

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

Tracef 追踪

func Warnf

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

Warnf 警告

Types

type ILevel added in v0.5.0

type ILevel interface{ All() []Level }

type Ilogger added in v0.5.0

type Ilogger interface {
	Debugf(format string, v ...any)
	Errorf(format string, v ...any)
	Fatalf(format string, v ...any)
	Infof(format string, v ...any)
	SetNotify(notify Notifier)
	Tracef(format string, v ...any)
	Warnf(format string, v ...any)
}

type Level

type Level string

Level 日志等级

const (
	FatalLevel Level = "FATAL"
	ErrorLevel Level = "ERROR"
	WarnLevel  Level = "WARN"
	InfoLevel  Level = "INFO"
	DebugLevel Level = "DEBUG"
	TraceLevel Level = "TRACE"
)

日志级别--https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels

func (Level) All

func (l Level) All() []Level

type Logger

type Logger interface {
	SetNotify(notify Notifier)
	Fatalf(format string, v ...any) // Mark the level fatal, but not panic or exit
	Errorf(format string, v ...any)
	Warnf(format string, v ...any)
	Infof(format string, v ...any)
	Debugf(format string, v ...any)
	Tracef(format string, v ...any)
}

Logger 日志接口

func Default

func Default() Logger

Default 默认

func New

func New(out io.Writer, prefix string, flag int) Logger

New 新建

type Notifier

type Notifier interface {
	Levels() []Level
	Notify(msg string)
}

Notifier 通知接口

Jump to

Keyboard shortcuts

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