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 ¶ added in v0.18.0
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{}, error)
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 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 Stringify ¶ added in v0.30.5
func Stringify(v interface{}) string
Provides a canonical way to stringify keys
func Sync ¶ added in v0.18.0
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