logger

package
v0.0.0-...-b43dac0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Logger *zap.Logger
)

Functions

func Error

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

func Info

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

func LogIf

func LogIf(err error)

LogIf 当 err != nil 时记录 error 等级的日志

func LogInfoIf

func LogInfoIf(err error)

LogInfoIf 当 err != nil 时记录 info 等级的日志

func LogWarnIf

func LogWarnIf(err error)

LogWarnIf 当 err != nil 时记录 warning 等级的日志

func Warn

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

Types

type Option

type Option func(*Options)

func WithCompress

func WithCompress(compress bool) Option

func WithFileName

func WithFileName(filename string) Option

func WithMaxAge

func WithMaxAge(maxAge int) Option

func WithMaxBackup

func WithMaxBackup(maxBackup int) Option

func WithMaxSize

func WithMaxSize(maxSize int) Option

func WithOptionsType

func WithOptionsType(logType string) Option

type Options

type Options struct {
	FileName  string `json:"file_name"`
	MaxSize   int    `json:"max_size"`
	MaxAge    int    `json:"max_age"`
	MaxBackup int    `json:"max_backup"`
	Compress  bool   `json:"compress"`
	LogType   string `json:"log_type"`
	Debug     bool   `json:"debug"`
	Level     string `json:"level"`
}

Options 参数选项

func NewLogger

func NewLogger(options ...Option) *Options

NewLogger 构造方法

func (*Options) Init

func (l *Options) Init()

Init 初始化

Jump to

Keyboard shortcuts

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