report

package
v0.0.0-...-835e807 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	R = GetReport
)

Functions

func WithReport

func WithReport(ctx context.Context, r *Report) context.Context

WithReport attaches report to Context.

Types

type LogBasedReporter

type LogBasedReporter struct {
	*log.Logger
}

func (*LogBasedReporter) Log

func (l *LogBasedReporter) Log(record *Record)

type Report

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

Report provides an interface to collect specific types of key-value pairs.

func GetReport

func GetReport(ctx context.Context) *Report

GetReport returns a Report attached to Context. Or returns a global one.

func New

func New() *Report

func (*Report) AddDuration

func (r *Report) AddDuration(key string, value time.Duration)

func (*Report) AddError

func (r *Report) AddError(key string, err error)

func (*Report) AddInt

func (r *Report) AddInt(key string, v int64)

AddInt adds int64 value to report

func (*Report) AddString

func (r *Report) AddString(key string, v string)

AddString adds string value to report

func (*Report) Report

func (r *Report) Report(s Sink)

type Sink

type Sink interface {
	Log(record *Record)
}

Jump to

Keyboard shortcuts

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