report

package
v0.0.0-...-6b846f9 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoReport = errors.New("no report")
)

errors

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Timestamp time.Time     `json:"ts"`
	Level     zapcore.Level `json:"lvl"`
	Message   string        `json:"msg"`
	Fields    []zap.Field   `json:"fs"`
}

Entry represents a single Log entry of the report

type Error

type Error struct {
	Token   string `json:"token"`
	Cause   string `json:"cause"`
	Message string `json:"msg"`
	// contains filtered or unexported fields
}

type Log

type Log []Entry

Log is a named slice used inside the report

func (*Log) AddEntry

func (l *Log) AddEntry(lvl zapcore.Level, msg string, fields ...zap.Field)

type Report

type Report struct {
	Err Error `json:"error"`
	Log Log   `json:"log"`

	sync.RWMutex
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) (rep *Report, err error)

func New

func New(l *zap.Logger) *Report

func NewWithContext

func NewWithContext(parent context.Context, l *zap.Logger) (*Report, context.Context)

func (*Report) Debug

func (rep *Report) Debug(msg string, fields ...zap.Field)

func (*Report) Error

func (rep *Report) Error(msg string, fields ...zap.Field)

func (*Report) HasError

func (rep *Report) HasError() bool

func (*Report) Info

func (rep *Report) Info(msg string, fields ...zap.Field)

func (*Report) Warn

func (rep *Report) Warn(msg string, fields ...zap.Field)

func (*Report) WithError

func (rep *Report) WithError(token string, err error) *Report

func (*Report) Wrap

func (rep *Report) Wrap(token string, err error, msg string) *Report

func (*Report) Wrapf

func (rep *Report) Wrapf(token string, err error, msg string, args ...interface{}) *Report

Jump to

Keyboard shortcuts

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