log

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

一个自用的日志库

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Filename:   "/tmp/app.log",
	MaxSize:    128,
	MaxBackups: 10,
	MaxAge:     180,
	Compress:   true,
}

Functions

func GetLogLevel

func GetLogLevel(lv string) (level zapcore.Level)

Types

type Config

type Config struct {
	Filename   string `json:"filename" yaml:"filename"`       //日志文件路径
	MaxSize    int    `json:"max_size" yaml:"max_size"`       //每个日志文件保存的最大尺寸 单位:M
	MaxBackups int    `json:"max_backups" yaml:"max_backups"` //日志文件最多保存多少个备份
	MaxAge     int    `json:"max_age" yaml:"max_age"`         //文件最多保存多少天
	Compress   bool   `json:"compress" yaml:"compress"`       //是否压缩
}

type Logger

type Logger struct {
	*zap.Logger
}

func NewLogger

func NewLogger(level zapcore.Level, config ...Config) (*Logger, error)

func (*Logger) IsZapField

func (l *Logger) IsZapField(arg interface{}) (boo bool)

Directories

Path Synopsis
internal
lumberjack
Package lumberjack provides a rolling logger.
Package lumberjack provides a rolling logger.

Jump to

Keyboard shortcuts

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