mlog

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FormatJSON = "json"
	FormatText = "text"
)

Variables

This section is empty.

Functions

func Debug

func Debug(msg string, fields ...zap.Field)

func Error

func Error(msg string, fields ...zap.Field)

func Fatal

func Fatal(msg string, fields ...zap.Field)

func GetLogger

func GetLogger(opts ...zap.Option) *zap.Logger

GetLogger 从现有的 _logger 对象拷贝一个日志对象

func Info

func Info(msg string, fields ...zap.Field)

func InitLog

func InitLog(opts ...Option) error

func Panic

func Panic(msg string, fields ...zap.Field)

func Sync

func Sync() error

func Warn

func Warn(msg string, fields ...zap.Field)

Types

type LogConfig

type LogConfig struct {
	LogPath    string // 日志路径, 空将输出控制台
	LogLevel   string // 日志等级
	Compress   bool   // 压缩日志
	MaxSize    int    // log size (M)
	MaxAge     int    // 日志保存时间 (day)
	MaxBackups int    // 日志保存文件数
	Format     string // 日志类型 text or json
}

type Option

type Option func(cfg *LogConfig)

Jump to

Keyboard shortcuts

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