logger

package
v0.20.14 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2021 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Default = New(Options{
		SlowThreshold: 200 * time.Millisecond,
		LogLevel:      Warn,
	})
	Recorder = traceRecorder{Interface: Default, BeginAt: time.Now()}
)

Functions

func ExplainSQL

func ExplainSQL(sql string, numericPlaceholder *regexp.Regexp, escaper string, avars ...interface{}) string

Types

type Interface

type Interface interface {
	Info(ctx context.Context, msg string, data ...interface{})
	Warn(ctx context.Context, msg string, data ...interface{})
	Error(ctx context.Context, msg string, data ...interface{})
	Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
}

Interface logger interface

func New

func New(opt Options) Interface

type LogLevel

type LogLevel int
const (
	Silent LogLevel = iota + 1
	Error
	Warn
	Info
)

type Options

type Options struct {
	SlowThreshold time.Duration
	LogLevel      LogLevel
}

Jump to

Keyboard shortcuts

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