tendermint/log.go

31 lines
587 B
Go
Raw Normal View History

2014-07-08 15:33:26 -07:00
package main
import (
2014-07-14 16:15:13 -07:00
"os"
"github.com/op/go-logging"
2014-07-08 15:33:26 -07:00
"github.com/tendermint/tendermint/p2p"
)
2014-07-14 16:15:13 -07:00
var log = logging.MustGetLogger("main")
2014-07-08 15:33:26 -07:00
func init() {
2014-07-14 16:15:13 -07:00
// Customize the output format
logging.SetFormatter(logging.MustStringFormatter("[%{level:.4s}] %{time:2006-01-02T15:04:05} %{shortfile:-20s} %{message}"))
logBackend := logging.NewLogBackend(os.Stderr, "", 0)
logBackend.Color = true
logging.SetBackend(logBackend)
2014-07-08 15:33:26 -07:00
2014-07-14 16:15:13 -07:00
// Test
/*
Log.Debug("debug")
Log.Info("info")
Log.Notice("notice")
Log.Warning("warning")
Log.Error("error")
*/
2014-07-08 15:33:26 -07:00
p2p.SetLogger(log)
}