log

package
v1.1.0-alpha Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2017 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encoder

type Encoder interface {
	EmitString(key, value string)
	EmitBool(key string, value bool)
	EmitInt(key string, value int)
	EmitInt32(key string, value int32)
	EmitInt64(key string, value int64)
	EmitUint32(key string, value uint32)
	EmitUint64(key string, value uint64)
	EmitFloat32(key string, value float32)
	EmitFloat64(key string, value float64)
	EmitObject(key string, value interface{})
	EmitLazyLogger(value LazyLogger)
}

Encoder allows access to the contents of a Field (via a call to Field.Marshal).

Tracer implementations typically provide an implementation of Encoder; OpenTracing callers typically do not need to concern themselves with it.

type Field

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

Field instances are constructed via LogBool, LogString, and so on. Tracing implementations may then handle them via the Field.Marshal method.

"heavily influenced by" (i.e., partially stolen from) https://github.com/uber-go/zap

func Bool

func Bool(key string, val bool) Field

Bool adds a bool-valued key:value pair to a Span.LogFields() record

func Error

func Error(err error) Field

Error adds an error with the key "error" to a Span.LogFields() record

func Float32

func Float32(key string, val float32) Field

Float32 adds a float32-valued key:value pair to a Span.LogFields() record

func Float64

func Float64(key string, val float64) Field

Float64 adds a float64-valued key:value pair to a Span.LogFields() record

func Int

func Int(key string, val int) Field

Int adds an int-valued key:value pair to a Span.LogFields() record

func Int32

func Int32(key string, val int32) Field

Int32 adds an int32-valued key:value pair to a Span.LogFields() record

func Int64

func Int64(key string, val int64) Field

Int64 adds an int64-valued key:value pair to a Span.LogFields() record

func InterleavedKVToFields

func InterleavedKVToFields(keyValues ...interface{}) ([]Field, error)

InterleavedKVToFields converts keyValues a la Span.LogKV() to a Field slice a la Span.LogFields().

func Lazy

func Lazy(ll LazyLogger) Field

Lazy adds a LazyLogger to a Span.LogFields() record; the tracing implementation will call the LazyLogger function at an indefinite time in the future (after Lazy() returns).

func Object

func Object(key string, obj interface{}) Field

Object adds an object-valued key:value pair to a Span.LogFields() record

func String

func String(key, val string) Field

String adds a string-valued key:value pair to a Span.LogFields() record

func Uint32

func Uint32(key string, val uint32) Field

Uint32 adds a uint32-valued key:value pair to a Span.LogFields() record

func Uint64

func Uint64(key string, val uint64) Field

Uint64 adds a uint64-valued key:value pair to a Span.LogFields() record

func (Field) Key

func (lf Field) Key() string

Key returns the field's key.

func (Field) Marshal

func (lf Field) Marshal(visitor Encoder)

Marshal passes a Field instance through to the appropriate field-type-specific method of an Encoder.

func (Field) String

func (lf Field) String() string

String returns a string representation of the key and value.

func (Field) Value

func (lf Field) Value() interface{}

Value returns the field's value as interface{}.

type LazyLogger

type LazyLogger func(fv Encoder)

LazyLogger allows for user-defined, late-bound logging of arbitrary data

Jump to

Keyboard shortcuts

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