Documentation ¶
Index ¶
- Constants
- func Delete(slice []interface{}, i int, n int) []interface{}
- func DeleteAt(slice []interface{}, i int) []interface{}
- func DropKeys(keyvals []interface{}, dropKeyValPredicate func(key, value interface{}) bool) []interface{}
- func KeyValuesMap(keyvals []interface{}) map[string]interface{}
- func MapKeyValues(keyvals []interface{}, ...) ([]interface{}, error)
- func OnlyKeys(keyvals []interface{}, includeKeys ...interface{}) []interface{}
- func Reload(logger log.Logger) error
- func RemoveKeys(keyvals []interface{}, dropKeys ...interface{}) []interface{}
- func Signal(keyvals []interface{}) string
- func Stringify(v interface{}) string
- func Sync(logger log.Logger) error
- func Value(keyvals []interface{}, key interface{}) interface{}
- func ValuesAndContext(keyvals []interface{}, keys ...interface{}) (map[string]interface{}, []interface{})
- func Vectorise(keyvals []interface{}, vectorKeys ...string) []interface{}
- type Vector
Constants ¶
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 ¶
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 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 Sync ¶
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