-
Notifications
You must be signed in to change notification settings - Fork 3
/
log.go
24 lines (17 loc) · 880 Bytes
/
log.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package main
import (
"os"
"github.com/op/go-logging"
)
var log = logging.MustGetLogger("go-walletconnect-bridge")
// Example format string. Everything except the message has a custom color
// which is dependent on the log level. Many fields have a custom output
// formatting too, eg. the time returns the hour down to the milli second.
var _format = logging.MustStringFormatter(`%{color}%{time:2006-01-02 15:04:05} ▶ %{level:.4s} %{id:03d}%{color:reset} %{message}`)
// For demo purposes, create two backend for os.Stdout.
var _backend = logging.NewLogBackend(os.Stdout, "", 0)
// For messages written to backend2 we want to add some additional
// information to the output, including the used log level and the name of
// the function.
var _backendFormatter = logging.NewBackendFormatter(_backend, _format)
var leveledBackend = logging.SetBackend(_backendFormatter)