log

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2022 License: Apache-2.0 Imports: 5 Imported by: 6

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)
	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