structure

package
v0.24.6 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 3 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"
	// Trace for log call
	TraceKey = "trace"
	// Level name (string)
	LevelKey = "level"
	// Channel name in a vector channel logging context
	ChannelKey = "log_channel"
	// Log message (string)
	MessageKey = "message"
	// Error key
	ErrorKey = "error"
	// Captured logging source (like tendermint_log15, stdlib_log)
	CapturedLoggingSourceKey = "captured_logging_source"
	// Top-level component (choose one) name
	ComponentKey = "component"
	// Tendermint component etc
	Tendermint = "tendermint"
	// Vector-valued scope
	ScopeKey = "scope"
	// Globally unique identifier persisting while a single instance (root process)
	// of this program/service is running
	RunId = "run_id"
	// Provides special instructions (that may be ignored) to downstream loggers
	SignalKey = "__signal__"
	// The sync signal instructs sync-able loggers to sync
	SyncSignal       = "__sync__"
	ReloadSignal     = "__reload__"
	InfoChannelName  = "Info"
	TraceChannelName = "Trace"
)

Variables

This section is empty.

Functions

func CopyPrepend added in v0.18.0

func CopyPrepend(slice []interface{}, elements ...interface{}) []interface{}

Prepend elements to slice in the order they appear

func Delete added in v0.18.0

func Delete(slice []interface{}, i int, n int) []interface{}

Deletes n elements starting with the ith from a slice by splicing. Beware uses append so the underlying backing array will be modified!

func DeleteAt added in v0.18.0

func DeleteAt(slice []interface{}, i int) []interface{}

Delete an element at a specific index and return the contracted list

func DropKeys added in v0.18.0

func DropKeys(keyvals []interface{}, dropKeyValPredicate func(key, value interface{}) bool) []interface{}

Drops all key value pairs where dropKeyValPredicate is true

func KeyValuesMap added in v0.18.0

func KeyValuesMap(keyvals []interface{}) map[string]interface{}

Returns keyvals as a map from keys to vals

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 OnlyKeys added in v0.20.1

func OnlyKeys(keyvals []interface{}, includeKeys ...interface{}) []interface{}

func Reload added in v0.20.1

func Reload(logger log.Logger) error

func RemoveKeys added in v0.17.0

func RemoveKeys(keyvals []interface{}, dropKeys ...interface{}) []interface{}

func Signal added in v0.18.0

func Signal(keyvals []interface{}) string

Tried to interpret the logline as a signal by matching the last key-value pair as a signal, returns empty string if no match. The idea with signals is that the should be transmitted to a root logger as a single key-value pair so we avoid the need to do a linear probe over every log line in order to detect a signal.

func StringifyKey added in v0.18.0

func StringifyKey(key interface{}) string

Provides a canonical way to stringify keys

func Sync added in v0.18.0

func Sync(logger log.Logger) error

Sends the sync signal which causes any syncing loggers to sync. loggers receiving the signal should drop the signal logline from output

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[string]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

type Vector added in v0.18.0

type Vector []interface{}

To help with downstream serialisation

func (Vector) MarshalJSON added in v0.18.0

func (v Vector) MarshalJSON() ([]byte, error)

func (Vector) MarshalText added in v0.18.0

func (v Vector) MarshalText() ([]byte, error)

func (Vector) Slice added in v0.18.0

func (v Vector) Slice() []interface{}

func (Vector) String added in v0.18.0

func (v Vector) String() string

Jump to

Keyboard shortcuts

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