izap

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2020 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = zap.NewNop()
View Source
var Sugar = Logger.Sugar()

Functions

func New

func New(c Config) *zap.Logger

func ReplaceGlobals

func ReplaceGlobals(l *zap.Logger)

func SetLevel

func SetLevel(l zapcore.Level)

SetLevel 设置zap默认目志等级,线程安全

Types

type Config

type Config struct {
	Level       string `yaml:"level" json:"level"`             // 日志等级,默认info
	Format      string `yaml:"format" json:"format"`           // 编码格式: json or console 默认json
	EncodeLevel string `yaml:"encodeLevel" json:"encodeLevel"` // 编码器类型
	Writer      string `yaml:"write" json:"write"`             // 输出: file,console,multi
	Stack       bool   `yaml:"stack" json:"stack"`             // 使能栈调试输出
	Path        string `yaml:"path" json:"path"`               // 日志存放路径
	// 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