log

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 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 ...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 Tracef

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

Tracef 追踪

func Warnf

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

Warnf 警告

Types

type ILevel added in v0.5.0

type ILevel interface{ All() []Level }

type ILevelMock added in v0.5.0

type ILevelMock interface{ All() []Level }

type ILoggerMock added in v0.5.0

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

type INotifierMock added in v0.5.0

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

type Ilogger added in v0.5.0

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

type IloggerMock added in v0.5.0

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

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 LevelMock added in v0.5.0

type LevelMock struct {
	AllFunc func() []Level
}

func (*LevelMock) All added in v0.5.0

func (mockRecv *LevelMock) All() []Level

type LevelMockMock added in v0.5.0

type LevelMockMock struct {
	AllFunc func() []Level
}

func (*LevelMockMock) All added in v0.5.0

func (mockRecv *LevelMockMock) All() []Level

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 LoggerMock added in v0.5.0

type LoggerMock struct {
	DebugfFunc func(format string, v ...interface{})

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

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

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

	SetNotifyFunc func(notify Notifier)

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

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

func (*LoggerMock) Debugf added in v0.5.0

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

func (*LoggerMock) Errorf added in v0.5.0

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

func (*LoggerMock) Fatalf added in v0.5.0

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

func (*LoggerMock) Infof added in v0.5.0

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

func (*LoggerMock) SetNotify added in v0.5.0

func (mockRecv *LoggerMock) SetNotify(notify Notifier)

func (*LoggerMock) Tracef added in v0.5.0

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

func (*LoggerMock) Warnf added in v0.5.0

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

type LoggerMockMock added in v0.5.0

type LoggerMockMock struct {
	DebugfFunc func(format string, v ...interface{})

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

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

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

	SetNotifyFunc func(notify Notifier)

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

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

func (*LoggerMockMock) Debugf added in v0.5.0

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

func (*LoggerMockMock) Errorf added in v0.5.0

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

func (*LoggerMockMock) Fatalf added in v0.5.0

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

func (*LoggerMockMock) Infof added in v0.5.0

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

func (*LoggerMockMock) SetNotify added in v0.5.0

func (mockRecv *LoggerMockMock) SetNotify(notify Notifier)

func (*LoggerMockMock) Tracef added in v0.5.0

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

func (*LoggerMockMock) Warnf added in v0.5.0

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

type Notifier

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

Notifier 通知接口

type NotifierMock added in v0.5.0

type NotifierMock struct {
	LevelsFunc func() []Level

	NotifyFunc func(msg string)
}

func (*NotifierMock) Levels added in v0.5.0

func (mockRecv *NotifierMock) Levels() []Level

func (*NotifierMock) Notify added in v0.5.0

func (mockRecv *NotifierMock) Notify(msg string)

type NotifierMockMock added in v0.5.0

type NotifierMockMock struct {
	LevelsFunc func() []Level

	NotifyFunc func(msg string)
}

func (*NotifierMockMock) Levels added in v0.5.0

func (mockRecv *NotifierMockMock) Levels() []Level

func (*NotifierMockMock) Notify added in v0.5.0

func (mockRecv *NotifierMockMock) Notify(msg string)

Jump to

Keyboard shortcuts

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