structure

package
v0.0.0-...-2935fa7 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 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"
	// Tx hash key
	TxHashKey = "tx_hash"
	// 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 Delete

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

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

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

func DropKeys

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

Drops all key value pairs where dropKeyValPredicate is true

func KeyValuesMap

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{}, error)

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

func OnlyKeys

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

func Reload

func Reload(logger log.Logger) error

func RemoveKeys

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

func Signal

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 Stringify

func Stringify(v interface{}) string

Provides a canonical way to stringify keys

func Sync

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

type Vector []interface{}

To help with downstream serialisation

func (Vector) MarshalJSON

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

func (Vector) MarshalText

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

func (Vector) Slice

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

func (Vector) String

func (v Vector) String() string

Jump to

Keyboard shortcuts

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