logger

package
v0.0.0-...-fe528e9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

日志部分

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LevelMap = map[Level]string{
	DEBUG: "DEBUG",
	INFO:  "INFO",
	WARN:  "WARN",
	ERROR: "ERROR",
	FATAL: "FATAL",
	PANIC: "PANIC",
}

Functions

func GetEnCoder

func GetEnCoder() zapcore.Encoder

设置日志编码器

func GetErrorWriterSyncer

func GetErrorWriterSyncer(dir string) zapcore.WriteSyncer

生成故障信息的Writer

func GetInfoWriterSyncer

func GetInfoWriterSyncer(dir string) zapcore.WriteSyncer

生成普通信息的Writer

Types

type Level

type Level int8
const (
	DEBUG Level = iota
	INFO
	WARN
	ERROR
	FATAL
	PANIC
)

func (Level) String

func (s Level) String() string

type Log

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

func NewDefaultLog

func NewDefaultLog() *Log

func NewSaveFileLog

func NewSaveFileLog(path string) *Log

func (*Log) GetLogger

func (g *Log) GetLogger()

func (*Log) L

func (g *Log) L() *zap.SugaredLogger

获取一个日志

func (*Log) SetDirPath

func (g *Log) SetDirPath(path string) bool

func (*Log) SetLevel

func (g *Log) SetLevel(level Level)

func (*Log) SetSaveFile

func (g *Log) SetSaveFile(save bool)

Jump to

Keyboard shortcuts

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