logger

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogrusHandler

func LogrusHandler(hook logrus.Hook) log.Handler

LogrusHandler converts logrus hook to log handler.

func SetDSN

func SetDSN(value string)

SetDSN appends sentry hook to log root handler.

func SetLevel

func SetLevel(l string)

SetLevel sets level filter on log root handler. So it should be called last.

func SetTestMode

func SetTestMode(t testing.TB)

SetTestMode sets test mode.

func TestHandler

func TestHandler(t testing.TB, fmtr log.Format) log.Handler

TestHandler writes into test log.

Types

type Instance

type Instance struct {
	Log log.Logger
}

func New added in v1.0.2

func New(name ...string) Instance

type Periodic

type Periodic struct {
	Instance
	// contains filtered or unexported fields
}

Periodic is the same as logger.Instance, but writes only once in a period

func (*Periodic) Debug

func (l *Periodic) Debug(period time.Duration, msg string, ctx ...interface{})

Debug is timed log.Debug

func (*Periodic) Error

func (l *Periodic) Error(period time.Duration, msg string, ctx ...interface{})

Error is timed log.Error

func (*Periodic) Info

func (l *Periodic) Info(period time.Duration, msg string, ctx ...interface{})

Info is timed log.Info

func (*Periodic) Trace

func (l *Periodic) Trace(period time.Duration, msg string, ctx ...interface{})

Trace is timed log.Trace

func (*Periodic) Warn

func (l *Periodic) Warn(period time.Duration, msg string, ctx ...interface{})

Warn is timed log.Warn

Jump to

Keyboard shortcuts

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