izap

package
v0.0.0-...-cfb18d5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c Config) *zap.Logger

Types

type Config

type Config struct {
	Level       string      `yaml:"level" json:"level"`             // 日志等级, debug,info,warn,error,dpanic,panic,fatal 默认info
	Format      string      `yaml:"format" json:"format"`           // 编码格式: json or console 默认json
	EncodeLevel string      `yaml:"encodeLevel" json:"encodeLevel"` // 编码器类型, 默认 LowercaseLevelEncoder
	Adapter     string      `yaml:"adapter" json:"adapter"`         // 输出: file,console,multi,custom 默认 console
	Stack       bool        `yaml:"stack" json:"stack"`             // 使能栈调试输出 , 默认false
	Path        string      `yaml:"path" json:"path"`               // 日志存放路径, 默认 empty
	Writer      []io.Writer `yaml:"-" json:"-"`                     // 当 adapter=custom使用,如为writer为空,将使用os.Stdout
	// see lumberjack.Logger
	FileName   string `yaml:"fileName" json:"fileName"`     // 文件名,空字符使用默认    默认<processname>-lumberjack.log
	MaxSize    int    `yaml:"maxSize" json:"maxSize"`       // 每个日志文件最大尺寸(MB) 默认100MB,
	MaxAge     int    `yaml:"maxAge" json:"maxAge"`         // 日志文件保存天数, 默认0不删除
	MaxBackups int    `yaml:"maxBackups" json:"maxBackups"` // 日志文件保存备份数, 默认0都保存
	LocalTime  bool   `yaml:"localTime" json:"localTime"`   // 是否格式化时间戳, 默认UTC时间
	Compress   bool   `yaml:"compress" json:"compress"`     // 压缩文件,采用gzip, 默认不压缩
}

Config 日志配置

Jump to

Keyboard shortcuts

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