structure

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Log time (time.Time)
	TimeKey = "time"
	// Call site for log invocation (go-stack.Call)
	CallerKey = "caller"
	// Level name (string)
	LevelKey = "level"
	// Channel name in a vector channel logging context
	ChannelKey = "channel"
	// Log message (string)
	MessageKey = "message"
	// Captured logging source (like tendermint_log15, stdlib_log)
	CapturedLoggingSourceKey = "captured_logging_source"
	// Top-level component (choose one) name
	ComponentKey = "component"
	// Vector-valued scope
	ScopeKey = "scope"
	// Globally unique identifier persisting while a single instance (root process)
	// of this program/service is running
	RunId = "run_id"
)

Variables

This section is empty.

Functions

func KeyFromValue

func KeyFromValue(val interface{}) string

Obtain a canonical key from a value. Useful for structured logging where the type of value alone may be sufficient to determine its key. Providing this function centralises any convention over type names

func MapKeyValues

func MapKeyValues(keyvals []interface{}, fn func(interface{}, interface{}) (interface{}, interface{})) []interface{}

Maps key values pairs with a function (key, value) -> (new key, new value)

func Value

func Value(keyvals []interface{}, key interface{}) interface{}

Return a single value corresponding to key in keyvals

func ValuesAndContext

func ValuesAndContext(keyvals []interface{},
	keys ...interface{}) (map[interface{}]interface{}, []interface{})

Pull the specified values from a structured log line into a map. Assumes keys are single-valued. Returns a map of the key-values from the requested keys and the unmatched remainder keyvals as context as a slice of key-values.

func Vectorise

func Vectorise(keyvals []interface{}, vectorKeys ...string) []interface{}

'Vectorises' values associated with repeated string keys member by collapsing many values into a single vector value. The result is a copy of keyvals where the first occurrence of each matching key and its first value are replaced by that key and all of its values in a single slice.

Types

This section is empty.

Jump to

Keyboard shortcuts

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