logger

package
v0.0.0-...-d05db29 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(option Option) logger.Interface

New 实例化日志对象

Types

type LogWriter

type LogWriter interface {
	Info(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
}

type Logger

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

func (*Logger) Error

func (l *Logger) Error(ctx context.Context, s string, i ...interface{})

func (*Logger) Info

func (l *Logger) Info(ctx context.Context, s string, i ...interface{})

func (*Logger) LogMode

func (l *Logger) LogMode(level logger.LogLevel) logger.Interface

func (*Logger) Trace

func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (sql string, rowsAffected int64), err error)

func (*Logger) Warn

func (l *Logger) Warn(ctx context.Context, s string, i ...interface{})

type Option

type Option struct {
	xlog.Config
	Level                     string        `json:"level" yaml:"level"`
	Slow                      time.Duration `json:"slow" yaml:"slow"`
	IgnoreRecordNotFoundError bool          `json:"ignoreNotFound" yaml:"ignoreNotFound"`
	InfoStr                   string        `json:"infoStr" yaml:"infoStr"`
	WarnStr                   string        `json:"warnStr" yaml:"warnStr"`
	ErrStr                    string        `json:"errStr" yaml:"errStr"`
	TraceStr                  string        `json:"traceStr" yaml:"traceStr"`
	TraceErrStr               string        `json:"traceErrStr" yaml:"traceErrStr"`
	TraceWarnStr              string        `json:"traceWarnStr" yaml:"traceWarnStr"`
}

Jump to

Keyboard shortcuts

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