提交 183dd990 作者: Brian Tiger Chow

feat(eventlog) include timestamp in log

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>

# TYPES
# feat
# fix
# docs
# style (formatting, missing semi colons, etc; no code change):
# refactor
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)
上级 bd51b821
package elog
import (
"os"
"time"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/Sirupsen/logrus"
......@@ -73,14 +73,7 @@ func (el *eventLogger) Event(ctx context.Context, event string, metadata ...Logg
}
accum["event"] = event
accum["system"] = el.system
accum["time"] = util.FormatRFC3339(time.Now())
logrus.WithFields(map[string]interface{}(accum)).Info(event)
}
func init() {
// TODO use both text formatter and json formatter
// logrus.SetFormatter(new(logrus.TextFormatter))
logrus.SetFormatter(new(logrus.JSONFormatter))
logrus.SetOutput(os.Stderr)
logrus.SetLevel(logrus.DebugLevel)
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论