logger

package
v2.2.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2020 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package logger contains logging utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(ctx context.Context) *logrus.Entry

Get returns logrus entry for given context. Set must be called before this method is called.

func MakeRequestID

func MakeRequestID() string

MakeRequestID returns a new request ID.

func Set

func Set(ctx context.Context, requestID string) context.Context

Set returns derived context with set logrus entry with given request ID.

func SetEntry

func SetEntry(ctx context.Context, l *logrus.Entry) context.Context

SetEntry returns derived context with set given logrus entry.

Types

type GRPC

type GRPC struct {
	*logrus.Entry
}

GRPC is a compatibility wrapper between logrus entry and gRPC logger interface.

func (*GRPC) Info

func (v *GRPC) Info(args ...interface{})

override InfoXXX methods with TraceXXX to keep gRPC and logrus levels in sync

func (*GRPC) Infof

func (v *GRPC) Infof(format string, args ...interface{})

func (*GRPC) Infoln

func (v *GRPC) Infoln(args ...interface{})

func (*GRPC) V

func (v *GRPC) V(l int) bool

V reports whether verbosity level l is at least the requested verbose level.

type Reform

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

Reform is a SQL logger with metrics.

TODO https://jira.percona.com/browse/PMM-5302 Move to percona/pmm utils and use in pmm-agent and qan-api2.

func NewReform

func NewReform(driver, dbName string, printf reform.Printf) *Reform

NewReform creates a new logger with given parameters.

func (*Reform) After

func (r *Reform) After(query string, args []interface{}, d time.Duration, err error)

After implements reform.Logger.

func (*Reform) Before

func (r *Reform) Before(query string, args []interface{})

Before implements reform.Logger.

func (*Reform) Collect

func (r *Reform) Collect(ch chan<- prom.Metric)

Collect implements prom.Collector.

func (*Reform) Describe

func (r *Reform) Describe(ch chan<- *prom.Desc)

Describe implements prom.Collector.

func (*Reform) Requests

func (r *Reform) Requests() int

Requests returns a total number of queries started.

func (*Reform) Reset

func (r *Reform) Reset()

Reset sets all metrics to 0.

Jump to

Keyboard shortcuts

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