logis

package
v0.0.0-...-9c04300 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GradeDebug = "debug"
	GradeInfo  = "info"
	GradeWarn  = "warn"
	GradeError = "error"
	GradeFatal = "fatal"
)
View Source
const (
	Module = "module"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	// contains filtered or unexported fields
}

日志入口

func NewEntry

func NewEntry(strap Strap) *Entry

func (*Entry) Data

func (entry *Entry) Data(value interface{}) Logger

func (*Entry) Debug

func (entry *Entry) Debug(args ...interface{})

func (*Entry) Debugf

func (entry *Entry) Debugf(format string, args ...interface{})

func (*Entry) Err

func (entry *Entry) Err(err error) Logger

func (*Entry) Error

func (entry *Entry) Error(args ...interface{})

func (*Entry) Errorf

func (entry *Entry) Errorf(format string, args ...interface{})

func (*Entry) Fatal

func (entry *Entry) Fatal(args ...interface{})

func (*Entry) Fatalf

func (entry *Entry) Fatalf(format string, args ...interface{})

func (*Entry) Field

func (entry *Entry) Field(key string, value interface{}) Logger

func (*Entry) Fields

func (entry *Entry) Fields(fields context.Fields) Logger

func (*Entry) Info

func (entry *Entry) Info(args ...interface{})

func (*Entry) Infof

func (entry *Entry) Infof(format string, args ...interface{})

func (*Entry) Level

func (entry *Entry) Level(level Level) Logger

func (*Entry) Log

func (entry *Entry) Log(level Level, args ...interface{})

func (*Entry) Logf

func (entry *Entry) Logf(level Level, format string, args ...interface{})

func (*Entry) Warn

func (entry *Entry) Warn(args ...interface{})

func (*Entry) Warnf

func (entry *Entry) Warnf(format string, args ...interface{})

type Grade

type Grade string

func (Grade) Level

func (grade Grade) Level() Level

type Level

type Level int8
const (
	DEBUG Level = 1 << iota
	INFO
	WARN
	ERROR
	FATAL
	INVALID
)

func (Level) Enable

func (level Level) Enable(other Level) bool

func (Level) Grade

func (level Level) Grade() Grade

func (Level) Valid

func (level Level) Valid() bool

type Log

type Log struct {
	Level   Level            // 等级
	Error   string           // 错误信息
	Message string           // 文本内容
	Time    time.Time        // 时间
	Value   interface{}      // 即时数据
	Context *context.Context // 上下文
}

type Logger

type Logger interface {
	Level(level Level) Logger
	Field(key string, value interface{}) Logger
	Fields(fields context.Fields) Logger
	Err(err error) Logger
	Data(value interface{}) Logger
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
}

type Strap

type Strap interface {
	Enable(Level) bool
	Hook(log *Log)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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