logger

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger interface {
	Debug(msg string, fields ...zap.Field)
	Info(msg string, fields ...zap.Field)
	Warn(msg string, fields ...zap.Field)
	Error(msg string, fields ...zap.Field)
	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Sync() error
}

Logger 接口定义了日志记录的基本方法

func NewDefault

func NewDefault() Logger

NewDefault 创建默认的 logger(输出到标准输出)

func NewProduction

func NewProduction(logFilePath string, level zapcore.Level) (Logger, error)

NewProduction 创建生产环境的 logger(JSON格式,同时输出到文件和控制台)

func NewZapLogger

func NewZapLogger(zl *zap.Logger) Logger

NewZapLogger 从 zap.Logger 创建 Logger 实例

Jump to

Keyboard shortcuts

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