logger

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(args ...interface{})

Debug logs a message at debug level

func Debugf

func Debugf(template string, args ...interface{})

Debugf logs a formatted message at debug level

func Error

func Error(args ...interface{})

Error logs a message at error level

func Errorf

func Errorf(template string, args ...interface{})

Errorf logs a formatted message at error level

func Info

func Info(args ...interface{})

Info logs a message at info level

func Infof

func Infof(template string, args ...interface{})

Infof logs a formatted message at info level

func Init

func Init(cfg *Config) error

Init initializes the global logger

func Warn

func Warn(args ...interface{})

Warn logs a message at warn level

func Warnf

func Warnf(template string, args ...interface{})

Warnf logs a formatted message at warn level

func WithModule

func WithModule(module string) *zap.SugaredLogger

WithModule returns a logger with module field

Types

type Config

type Config struct {
	Level      string `mapstructure:"level"`       // debug, info, warn, error
	Filename   string `mapstructure:"filename"`    // 日志文件路径
	MaxSize    int    `mapstructure:"max_size"`    // 每个日志文件的最大大小(MB)
	MaxBackups int    `mapstructure:"max_backups"` // 保留的旧日志文件最大数量
	MaxAge     int    `mapstructure:"max_age"`     // 保留的旧日志文件的最大天数
	Compress   bool   `mapstructure:"compress"`    // 是否压缩旧日志文件
}

Config represents logger configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns default logger configuration

Jump to

Keyboard shortcuts

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