Skip to content

Commit 095f817

Browse files
committed
feat(logging): log timestamps in RFC3339Nano
- Changes the timestamp format to human-readable RFC3339. - Increases the precision to nanosecond from second.
1 parent b261d60 commit 095f817

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

common/logging.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package common
22

33
import (
44
"os"
5+
"time"
56

67
"github.com/sirupsen/logrus"
78
)
@@ -11,10 +12,13 @@ func LogSetup(json bool, logLevel string) *logrus.Entry {
1112
log.Logger.SetOutput(os.Stdout)
1213

1314
if json {
14-
log.Logger.SetFormatter(&logrus.JSONFormatter{})
15+
log.Logger.SetFormatter(&logrus.JSONFormatter{
16+
TimestampFormat: time.RFC3339Nano,
17+
})
1518
} else {
1619
log.Logger.SetFormatter(&logrus.TextFormatter{
17-
FullTimestamp: true,
20+
TimestampFormat: time.RFC3339Nano,
21+
FullTimestamp: true,
1822
})
1923
}
2024

0 commit comments

Comments
 (0)