log

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: MIT Imports: 5 Imported by: 0

README

v1.0.0

基于zap,为了使用简单点

Documentation

Index

Constants

View Source
const (
	DebugLevel  = zapcore.DebugLevel
	InfoLevel   = zapcore.InfoLevel
	WarnLevel   = zapcore.WarnLevel
	ErrorLevel  = zapcore.ErrorLevel
	DPanicLevel = zapcore.DPanicLevel
	PanicLevel  = zapcore.PanicLevel
	FatalLevel  = zapcore.FatalLevel
)

Variables

This section is empty.

Functions

func Debug

func Debug(format string, val ...interface{})

func Error

func Error(format string, val ...interface{})

func Fatal

func Fatal(format string, val ...interface{})

func Info

func Info(format string, val ...interface{})

func LevelStr

func LevelStr(str string) zapcore.Level

func NewLogger

func NewLogger(filePath string, level zapcore.Level, maxSize int, maxBackups int, maxAge int, json bool) *zap.SugaredLogger

*

  • 获取日志
  • filePath 日志文件路径
  • level 日志级别
  • maxSize 每个日志文件保存的最大尺寸 单位:M
  • maxBackups 日志文件最多保存多少个备份
  • maxAge 文件最多保存多少天
  • json 是否json格式输出

func Set

func Set(cfg *Config)

func Warn

func Warn(format string, val ...interface{})

Types

type Config

type Config struct {
	Filename   string        // 日志文件路径
	Level      zapcore.Level // 日志等级
	MaxSize    int           // 每个日志文件保存的最大尺寸 单位:M
	MaxBackups int           // 日志文件最多保存多少个备份
	MaxAge     int           // 文件最多保存多少天
	Json       bool          // 是否json格式输出
}

Jump to

Keyboard shortcuts

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