Skip to content

Commit 8162e78

Browse files
authored
better log timestamps (#52)
1 parent 7db1a0a commit 8162e78

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

server/main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"github.com/spf13/cobra"
3232
"github.com/spf13/viper"
3333
"go.uber.org/zap"
34+
"go.uber.org/zap/zapcore"
3435
"google.golang.org/grpc"
3536
"google.golang.org/grpc/credentials"
3637
)
@@ -87,7 +88,14 @@ func init() {
8788
}
8889

8990
func run() {
90-
logger, _ = zap.NewProduction()
91+
92+
cfg := zap.NewProductionConfig()
93+
cfg.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder
94+
95+
logger, err := cfg.Build()
96+
if err != nil {
97+
panic(err)
98+
}
9199
defer func() {
92100
err := logger.Sync() // flushes buffer, if any
93101
if err != nil {

0 commit comments

Comments
 (0)