logger

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2019 License: MIT, MIT Imports: 4 Imported by: 10

README

golang logger

基于uber zap封装而成的logger模块,可用于go应用中记录操作日志。

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DPanic

func DPanic(msg string, fields ...zap.Field)

调试模式下的panic,程序不退出,继续运行

func Debug

func Debug(msg string, fields ...zap.Field)

func Error

func Error(msg string, fields ...zap.Field)

func Fatal

func Fatal(msg string, fields ...zap.Field)

抛出致命错误,然后退出程序

func Info

func Info(msg string, fields ...zap.Field)

func InitLogger

func InitLogger()

func LogCompress

func LogCompress(b bool)

func LogLevel

func LogLevel(lvl string)

func LogSugar

func LogSugar() *zap.SugaredLogger

sugar语法糖,支持简单的msg信息打印 支持Debug,Info,Error,Panic,Warn,Fatal等方法

func MaxAge

func MaxAge(n int)

func MaxSize

func MaxSize(n int)

func Panic

func Panic(msg string, fields ...zap.Field)

下面的panic,fatal一般不建议使用,除非不可恢复的panic或致命错误程序必须退出 抛出panic的时候,先记录日志,然后执行panic,退出当前goroutine

func SetLogFile

func SetLogFile(fileName string)

设置日志文件路径,如果日志文件不存在zap会自动创建文件

func Warn

func Warn(msg string, fields ...zap.Field)

Types

This section is empty.

Jump to

Keyboard shortcuts

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