Skip to content

基于 zap 和 lumberjack 配置的日志输出工具

Notifications You must be signed in to change notification settings

yzhengwei/zaplog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

zaplog

基于 zap 和 lumberjack 配置的日志输出工具

Example

	logConfig := &zaplog.Config{
		Level:      "info",		
		LogFormat:  "json",			// 日志格式:json 或 文本格式,默认为文本
		LogPath:    "/data/logs/",
		Stacktrace: false,			// Error 及以上是否输出堆栈信息
		CallerSkip: false,			// 是否输出Caller上级调用位置
		Stdout:     false,			// 是否到标准输出,若到标准输出则不生成日志文件
		App:        "app",			// app  
		Group:      "",
		MaxSize:    0,
		MaxBackups: 0,
		MaxAge:     0,
		Compress:   false,
	}

	zaplog.InitLogger(logConfig)
	zaplog.Sync()

	zaplog.Infof("This is info ....")
	zaplog.Warnf("This is warn ....")

About

基于 zap 和 lumberjack 配置的日志输出工具

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages