log

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

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

Debugf 调试

func Errorf

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

Errorf 错误

func Fatalf

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

Fatalf 致命

func InLevel

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

InLevel 是否在指定Level里

func Infof

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

Infof 信息

func InitParamWithLogger

func InitParamWithLogger(param interface{}) (interface{}, error)

InitParamWithLogger 初始化param里的Logger

func Tracef

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

Tracef 追踪

func Warnf

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

Warnf 警告

Types

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

type Logger

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

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