File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -6,15 +6,22 @@ import (
66 "github.com/sirupsen/logrus"
77)
88
9+ // RFC3339Milli is a RFC3339 timestamp format restricted to millisecond precision.
10+ // No standard format is provided, so we create our own.
11+ const RFC3339Milli = "2006-01-02T15:04:05.000Z07:00"
12+
913func LogSetup (json bool , logLevel string ) * logrus.Entry {
1014 log := logrus .NewEntry (logrus .New ())
1115 log .Logger .SetOutput (os .Stdout )
1216
1317 if json {
14- log .Logger .SetFormatter (& logrus.JSONFormatter {})
18+ log .Logger .SetFormatter (& logrus.JSONFormatter {
19+ TimestampFormat : RFC3339Milli ,
20+ })
1521 } else {
1622 log .Logger .SetFormatter (& logrus.TextFormatter {
17- FullTimestamp : true ,
23+ TimestampFormat : RFC3339Milli ,
24+ FullTimestamp : true ,
1825 })
1926 }
2027
You can’t perform that action at this time.
0 commit comments