logger

package
v0.0.0-...-3cadddf Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Level      string                 `json:"level"`      // 日志级别:debug、info、warn、error、dpanic、panic、fatal
	File       string                 `json:"file"`       // 日志文件路径,不存在则报错
	MaxSize    int                    `json:"maxSize"`    // 每个日志文件保存的最大尺寸 单位:M
	MaxBackups int                    `json:"maxBackups"` // 日志文件最多保存多少个备份
	MaxAge     int                    `json:"maxAge"`     // 文件最多保存多少天
	Compress   bool                   `json:"compress"`   // 是否生成压缩文件
	Localtime  bool                   `json:"localtime"`  // 备份文件名称是否使用本地时间格式化,否则使用 UTC 时间
	Fields     map[string]interface{} `json:"fields"`     // 初始化字段
}

Logger option for configurations

type Logger

type Logger struct {
	*zap.Logger
}

Logger is a custom logger

func NewLogger

func NewLogger(config *Config) (*Logger, error)

NewZapLogger create a new zap.Logger

Jump to

Keyboard shortcuts

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