mirror of
https://github.com/status-im/status-go.git
synced 2025-01-09 14:16:21 +00:00
eeca435064
Update vendor Integrate rendezvous into status node Add a test with failover using rendezvous Use multiple servers in client Use discovery V5 by default and test that node can be started with rendezvous discovet Fix linter Update rendezvous client to one with instrumented stream Address feedback Fix test with updated topic limits Apply several suggestions Change log to debug for request errors because we continue execution Remove web3js after rebase Update rendezvous package
43 lines
1.1 KiB
Go
43 lines
1.1 KiB
Go
package log
|
|
|
|
// Loggable describes objects that can be marshalled into Metadata for logging
|
|
type Loggable interface {
|
|
Loggable() map[string]interface{}
|
|
}
|
|
|
|
// LoggableMap is just a generic map keyed by string. It
|
|
// implements the Loggable interface.
|
|
type LoggableMap map[string]interface{}
|
|
|
|
// Loggable implements the Loggable interface for LoggableMap
|
|
func (l LoggableMap) Loggable() map[string]interface{} {
|
|
return l
|
|
}
|
|
|
|
// LoggableF converts a func into a Loggable
|
|
type LoggableF func() map[string]interface{}
|
|
|
|
// Loggable implements the Loggable interface by running
|
|
// the LoggableF function.
|
|
func (l LoggableF) Loggable() map[string]interface{} {
|
|
return l()
|
|
}
|
|
|
|
// Deferred returns a LoggableF where the execution of the
|
|
// provided function is deferred.
|
|
func Deferred(key string, f func() string) Loggable {
|
|
function := func() map[string]interface{} {
|
|
return map[string]interface{}{
|
|
key: f(),
|
|
}
|
|
}
|
|
return LoggableF(function)
|
|
}
|
|
|
|
// Pair returns a Loggable where key is paired to Loggable.
|
|
func Pair(key string, l Loggable) Loggable {
|
|
return LoggableMap{
|
|
key: l,
|
|
}
|
|
}
|