log

package
v1.0.29 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *zap.Logger

Functions

func ColorErr

func ColorErr(a ...interface{})

func ColorFErr

func ColorFErr(w io.Writer, a []interface{})

func ColorFInfo

func ColorFInfo(w io.Writer, a []interface{})

func ColorFInfof

func ColorFInfof(w io.Writer, format string, a []interface{})

func ColorInfo

func ColorInfo(a ...interface{})

func ColorInfof

func ColorInfof(format string, a ...interface{})

func InitLogger

func InitLogger(appName string, optionals Optionals)

初始化日志对象

func NewDynamicCore added in v1.0.8

func NewDynamicCore(enc zapcore.Encoder, enab zapcore.LevelEnabler) zapcore.Core

func RandString

func RandString(n int) string

func RegisterWriter added in v1.0.8

func RegisterWriter(name string, w io.Writer) error

注册writer

func UnRegisterWriter added in v1.0.9

func UnRegisterWriter(name string)

删除writer

Types

type DynamicCore added in v1.0.8

type DynamicCore struct {
	zapcore.LevelEnabler
	// contains filtered or unexported fields
}

func (*DynamicCore) Check added in v1.0.8

func (*DynamicCore) Sync added in v1.0.8

func (d *DynamicCore) Sync() error

func (*DynamicCore) UnRegisterWriter added in v1.0.11

func (d *DynamicCore) UnRegisterWriter(name string)

func (*DynamicCore) With added in v1.0.8

func (d *DynamicCore) With(fields []zapcore.Field) zapcore.Core

func (*DynamicCore) Write added in v1.0.8

func (d *DynamicCore) Write(ent zapcore.Entry, fields []zapcore.Field) error

type Optionals

type Optionals struct {
	// 日志文件路径, 如果为空则不写入文件
	FilePath string
	// 日志是否输出到终端中
	Console bool
	// 动态日志
	DynamicLog bool
	// elk logstash 地址, 如果为空则不写入elk
	LogStash string
}

Jump to

Keyboard shortcuts

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