log

package
v0.0.0-...-6d34543 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DPanicc

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

func DPanicf

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

func Debugc

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

func Debugf

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

func Error

func Error(msg string)

func ErrorW

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

func Errorc

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

func Errorf

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

func Fatalc

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

func Fatalf

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

func Info

func Info(args ...interface{})

func InfoW

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

func Infoc

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

func Infof

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

func Panicc

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

func Panicf

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

func ParseLevel

func ParseLevel(lvl string) zapcore.Level

func Warnc

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

func Warnf

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

func WithFields

func WithFields(field Field) *zap.SugaredLogger

Types

type Config

type Config struct {
	Output       string // 日志的位置 file|both|stdout
	Level        string
	Format       string
	ReportCaller bool
	Stacktrace   bool
	ErrStats     bool
	File         string
	MaxSize      int  // 单个文件最大size
	MaxAge       int  // 保留旧文件的最大天数
	BackupCount  int  // 保留旧文件的最大个数
	Compress     bool // 是否压缩/归档旧文件
}

func (*Config) IsBothFileStdout

func (c *Config) IsBothFileStdout() bool

func (*Config) IsOutFile

func (c *Config) IsOutFile() bool

func (*Config) IsOutStdout

func (c *Config) IsOutStdout() bool

type Field

type Field map[string]interface{}

type Logger

type Logger interface {
	Error(msg string)

	Debugf(string, ...interface{})

	Infof(string, ...interface{})

	Info(...interface{})

	InfoW(string, ...interface{})

	Warnf(string, ...interface{})

	WarnW(string, ...interface{})

	Errorf(string, ...interface{})

	ErrorW(string, ...interface{})

	DPanicf(string, ...interface{})

	Panicf(string, ...interface{})

	Fatalf(string, ...interface{})

	Debugc(context.Context, string, ...interface{})

	Infoc(context.Context, string, ...interface{})

	Warnc(context.Context, string, ...interface{})

	Errorc(context.Context, string, ...interface{})

	DPanicc(context.Context, string, ...interface{})

	Panicc(context.Context, string, ...interface{})

	Fatalc(context.Context, string, ...interface{})

	WithFields(Field) *zap.SugaredLogger
}

func NewLogger

func NewLogger(options ...Option) Logger

func NewNullLogger

func NewNullLogger() Logger

type LoggerOptions

type LoggerOptions struct{}

func (LoggerOptions) WithDebug

func (LoggerOptions) WithDebug(debug bool) Option

func (LoggerOptions) WithLoggerConf

func (LoggerOptions) WithLoggerConf(conf config.Config) Option

type Option

type Option func(*logger)

Jump to

Keyboard shortcuts

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