feat(eventlog) include timestamp in log
License: MIT Signed-off-by: Brian 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)
Brian Tiger Chow committed
Nov 16, 2014 at 03:55 UTC
183dd990b69525d4d8a0bcbec053b0ba406e0d95
1 file changed
+2
-9
util/elog/log.go
+2
-9
@@ -1,7 +1,7 @@
1
package elog
2
3
import (
4
- "os"
4
+ "time"
5
6
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
7
"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
73
}
74
accum["event"] = event
75
accum["system"] = el.system
76
+ accum["time"] = util.FormatRFC3339(time.Now())
77
78
logrus.WithFields(map[string]interface{}(accum)).Info(event)
79
}
79
-
80
-func init() {
81
- // TODO use both text formatter and json formatter
82
- // logrus.SetFormatter(new(logrus.TextFormatter))
83
- logrus.SetFormatter(new(logrus.JSONFormatter))
84
- logrus.SetOutput(os.Stderr)
85
- logrus.SetLevel(logrus.DebugLevel)
86
-}