log

package
v0.0.0-...-535fc81 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Levels = map[string]zapcore.Level{
	"":      zapcore.DebugLevel,
	"debug": zapcore.DebugLevel,
	"info":  zapcore.InfoLevel,
	"warn":  zapcore.WarnLevel,
	"error": zapcore.ErrorLevel,
	"fatal": zapcore.FatalLevel,
}

Levels zapcore level

Functions

func DebugContext

func DebugContext(ctx context.Context, args ...interface{})

DebugContext 打印 Debug 日志

func DebugContextf

func DebugContextf(ctx context.Context, format string, args ...interface{})

DebugContextf 打印 Debug 日志

func Debugf

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

func ErrorContext

func ErrorContext(ctx context.Context, args ...interface{})

ErrorContext 打印 Error 日志

func ErrorContextf

func ErrorContextf(ctx context.Context, format string, args ...interface{})

func Errorf

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

Errorf 打印 Error 日志

func Fatalf

func Fatalf(format string, args ...interface{})

func InfoContext

func InfoContext(ctx context.Context, args ...interface{})

InfoContext 打印 Info 日志

func InfoContextf

func InfoContextf(ctx context.Context, format string, args ...interface{})

InfoContextf 打印 Info 日志

func Infof

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

func NewSugarLogger

func NewSugarLogger(options Options) *zapLoggerWrapper

func WarnContext

func WarnContext(ctx context.Context, args ...interface{})

WarnContext 打印 Warn 日志

func WarnContextf

func WarnContextf(ctx context.Context, format string, args ...interface{})

WarnContextf 打印 Warn 日志

func Warnf

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

Warnf 打印 Warn 日志

Types

type Logger

type Logger interface {
	Error(v ...interface{})
	Warn(v ...interface{})
	Info(v ...interface{})
	Debug(v ...interface{})
	Errorf(format string, v ...interface{})
	Warnf(format string, v ...interface{})
	Infof(format string, v ...interface{})
	Debugf(format string, v ...interface{})
}

func GetDefaultLogger

func GetDefaultLogger() Logger

type Option

type Option func(*Options)

func WithFileName

func WithFileName(filename string) Option

func WithLogLevel

func WithLogLevel(level string) Option

type Options

type Options struct {
	LogName    string // 日志名称
	LogLevel   string // 日志级别
	FileName   string // 文件名称
	MaxAge     int    // 日志保留时间,以天为单位
	MaxSize    int    // 日志保留大小,以 M 为单位
	MaxBackups int    // 保留文件个数
	Compress   bool   // 是否压缩
}

Options 选项配置

func NewOptions

func NewOptions(opts ...Option) Options

Jump to

Keyboard shortcuts

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