log

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLogger = &Logger{zerolog.New(os.Stderr).With().CallerWithSkipFrameCount(3).Logger(), context.Background()}

Functions

This section is empty.

Types

type LogOption added in v0.1.1

type LogOption func(o *Logger)

func WithFileLog added in v0.1.1

func WithFileLog(filename string, maxSize, maxBackups, maxAge int, compress, caller bool) LogOption

WithFileLog is print log to file filename log's file path maxSize 在进行切割之前,日志文件的最大大小(以MB为单位) maxBackups 保留旧文件的最大个数 maxAge:保留旧文件的最大天数 compress:是否压缩/归档旧文件

func WithLogLevel added in v0.1.1

func WithLogLevel(level string) LogOption

type Logger

type Logger struct {
	zerolog.Logger
	// contains filtered or unexported fields
}

func NewContextLogger added in v0.1.1

func NewContextLogger(ctx context.Context, ops ...LogOption) (*Logger, context.Context)

func NewLogger added in v0.1.1

func NewLogger(opts ...LogOption) *Logger

func (*Logger) Debug added in v0.1.1

func (l *Logger) Debug(msg string)

func (*Logger) Debugf added in v0.1.1

func (l *Logger) Debugf(format string, v ...interface{})

func (*Logger) Error added in v0.1.1

func (l *Logger) Error(msg string)

func (*Logger) Errorf added in v0.1.1

func (l *Logger) Errorf(format string, v ...interface{})

func (*Logger) Info added in v0.1.1

func (l *Logger) Info(msg string)

func (*Logger) Infof added in v0.1.1

func (l *Logger) Infof(format string, v ...interface{})

func (*Logger) Name added in v0.1.1

func (l *Logger) Name(name string) Logger

func (*Logger) Trace added in v0.1.1

func (l *Logger) Trace(traceId string) *Logger

func (*Logger) Warn added in v0.1.1

func (l *Logger) Warn(msg string)

func (*Logger) Warnf added in v0.1.1

func (l *Logger) Warnf(format string, v ...interface{})

func (*Logger) WithStr added in v0.1.1

func (l *Logger) WithStr(key, value string) Logger

Jump to

Keyboard shortcuts

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