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
56 lines
1.3 KiB
Go
56 lines
1.3 KiB
Go
package log
|
|
|
|
import (
|
|
"io"
|
|
|
|
logging "github.com/whyrusleeping/go-logging"
|
|
)
|
|
|
|
// WriterGroup is the global writer group for logs to output to
|
|
var WriterGroup = NewMirrorWriter()
|
|
|
|
// Option is a generic function
|
|
type Option func()
|
|
|
|
// Configure applies the provided options sequentially from left to right
|
|
func Configure(options ...Option) {
|
|
for _, f := range options {
|
|
f()
|
|
}
|
|
}
|
|
|
|
// LdJSONFormatter Option formats the event log as line-delimited JSON
|
|
var LdJSONFormatter = func() {
|
|
logging.SetFormatter(&PoliteJSONFormatter{})
|
|
}
|
|
|
|
// TextFormatter Option formats the event log as human-readable plain-text
|
|
var TextFormatter = func() {
|
|
logging.SetFormatter(logging.DefaultFormatter)
|
|
}
|
|
|
|
// Output returns an option which sets the the given writer as the new
|
|
// logging backend
|
|
func Output(w io.Writer) Option {
|
|
return func() {
|
|
backend := logging.NewLogBackend(w, "", 0)
|
|
logging.SetBackend(backend)
|
|
// TODO return previous Output option
|
|
}
|
|
}
|
|
|
|
// LevelDebug Option sets the log level to debug
|
|
var LevelDebug = func() {
|
|
logging.SetLevel(logging.DEBUG, "")
|
|
}
|
|
|
|
// LevelError Option sets the log level to error
|
|
var LevelError = func() {
|
|
logging.SetLevel(logging.ERROR, "")
|
|
}
|
|
|
|
// LevelInfo Option sets the log level to info
|
|
var LevelInfo = func() {
|
|
logging.SetLevel(logging.INFO, "")
|
|
}
|