log

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hook

type Hook struct {
	*Options
}

Hook

func New

func New(opts ...Option) *Hook

func (*Hook) After

func (hook *Hook) After(ctx context.Context, evt *otsql.Event)

func (*Hook) Before

func (hook *Hook) Before(ctx context.Context, evt *otsql.Event) context.Context

type Logger

type Logger interface {
	Debug(context.Context) *zerolog.Event
	Info(context.Context) *zerolog.Event
	Warn(context.Context) *zerolog.Event
	Error(context.Context) *zerolog.Event

	WithLevel(context.Context, zerolog.Level) *zerolog.Event
	GetLevel() zerolog.Level
}

Logger

func WrapZerolog

func WrapZerolog(logger zerolog.Logger) Logger

type Option

type Option func(*Options)

Option

func LogErrSkipAsWarn added in v0.17.0

func LogErrSkipAsWarn(b bool) Option

func WithArgs

func WithArgs(b bool) Option

func WithDefaultLevel

func WithDefaultLevel(level zerolog.Level) Option

func WithLogger

func WithLogger(logger Logger) Option

func WithMethodLevel

func WithMethodLevel(method otsql.Method, level zerolog.Level) Option

func WithQuery

func WithQuery(b bool) Option

func WithSlow

func WithSlow(d time.Duration) Option

type Options

type Options struct {
	Logger
	Slow time.Duration

	MethodLevels map[otsql.Method]zerolog.Level
	DefaultLevel zerolog.Level

	Query bool
	Args  bool

	LogErrSkipAsWarn bool
}

Jump to

Keyboard shortcuts

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