trace

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package trace implements a tracing system that can handle emitting large amounts of entries with minimal performance overhead.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Field

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

Field holds a single key/value pair in a trace Entry.

func Integer

func Integer(key string, value int64) Field

Integer returns a Field with an integer value.

func String

func String(key string, value string) Field

String returns a Field with a string value.

func (Field) String

func (f Field) String() string

type Set

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

Set manages the lifecycle of a set of Tracers.

When Tracer.Panic() is invoked on any of the tracers of this, the entries of all tracers in the set will be dumped as part of the panic message, ordered by timestamp.

func NewSet

func NewSet(retain int) *Set

NewSet creates a new tracer Set.

Each Set has a number of 'tracers', each holding a different buffer of trace entries, and each retaining at most 'retain' entrier.

func (*Set) Add

func (s *Set) Add(name string) *Tracer

Add a new tracer to the registry.

func (*Set) Del

func (s *Set) Del(name string)

Del removes the tracer with the given name.

func (*Set) Get

func (s *Set) Get(name string) *Tracer

Get the tracer with the given name, add one if does not exists.

func (*Set) String

func (s *Set) String() string

String returns a string representing all current entries, in all current tracers, ordered by timestamp.

func (*Set) Testing

func (s *Set) Testing(t testing.TB, node int)

Testing sets the tracers to log emitted entries through the given testing instance.

type Tracer

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

Tracer holds a buffer of recent trace entries in a trace Registry.

func (*Tracer) Error

func (t *Tracer) Error(message string, err error)

Emit a new trace entry with an error attached.

func (*Tracer) Message

func (t *Tracer) Message(message string, args ...interface{})

Message emits a new trace message.

func (*Tracer) Panic

func (t *Tracer) Panic(message string, v ...interface{})

Panic causes a Go panic which will print all trace entries across all tracers.

func (*Tracer) With

func (t *Tracer) With(fields ...Field) *Tracer

With returns a new Tracer instance emitting entries in the same buffer of this tracer, but with additional predefined fields.

Jump to

Keyboard shortcuts

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