trace

package
v0.0.0-...-0d6bb38 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package trace extends golang.org/x/net/trace.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContext

func NewContext(ctx context.Context, tr *Trace) context.Context

Types

type EventLog

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

EventLog is used for tracing long-lived objects.

func NewEventLog

func NewEventLog(family, title string) *EventLog

NewEventLog returns a new EventLog.

func (*EventLog) Errorf

func (e *EventLog) Errorf(format string, a ...interface{}) error

Errorf adds the message to the EventLog, with an error level.

func (*EventLog) Printf

func (e *EventLog) Printf(format string, a ...interface{})

Printf adds the message to the EventLog.

func (*EventLog) Write

func (e *EventLog) Write(p []byte) (n int, err error)

Write so EventLog implements io.Writer, which means it can be used as output for log.Logger.

type Trace

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

A Trace represents an active request.

func FromContext

func FromContext(ctx context.Context) (tr *Trace, ok bool)

func New

func New(family, title string) *Trace

New trace.

func (*Trace) Debugf

func (t *Trace) Debugf(format string, a ...interface{})

Debugf adds this message to the trace's log, with a debugging level.

func (*Trace) Error

func (t *Trace) Error(err error) error

Error marks the trace as having seen an error, and also logs it to the trace's log.

func (*Trace) Errorf

func (t *Trace) Errorf(format string, a ...interface{}) error

Errorf adds this message to the trace's log, with an error level.

func (*Trace) Finish

func (t *Trace) Finish()

Finish the trace. It should not be changed after this is called.

func (*Trace) Printf

func (t *Trace) Printf(format string, a ...interface{})

Printf adds this message to the trace's log.

func (*Trace) SetError

func (t *Trace) SetError()

SetError marks the trace as having received an error, without emitting any particular output.

func (*Trace) Write

func (t *Trace) Write(p []byte) (n int, err error)

Write so Trace implements io.Writer, which means it can be used as output for log.Logger.

Jump to

Keyboard shortcuts

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