OSDN Git Service

Optimize log time accuracy (#1593)
authoryahtoo <yahtoo.ma@gmail.com>
Thu, 28 Feb 2019 02:12:48 +0000 (10:12 +0800)
committerPaladz <yzhu101@uottawa.ca>
Thu, 28 Feb 2019 02:12:48 +0000 (10:12 +0800)
cmd/bytomd/main.go

index 999ad2c..4afb0d3 100644 (file)
@@ -5,6 +5,7 @@ import (
        "path"
        "runtime"
        "strings"
+       "time"
 
        log "github.com/sirupsen/logrus"
        "github.com/tendermint/tmlibs/cli"
@@ -41,7 +42,7 @@ func (hook ContextHook) Fire(entry *log.Entry) error {
 }
 
 func init() {
-       log.SetFormatter(&log.TextFormatter{FullTimestamp: true, DisableColors: true})
+       log.SetFormatter(&log.TextFormatter{TimestampFormat: time.StampMilli, DisableColors: true})
 
        // If environment variable BYTOM_DEBUG is not empty,
        // then add the hook to logrus and set the log level to DEBUG