Skip to content

Commit 41d8cde

Browse files
committed
adjust time format in logs to UTC
1 parent 1d126c6 commit 41d8cde

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/logging/logger.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import (
2929
"os"
3030
"strings"
3131
"sync"
32+
"time"
3233

3334
"github.com/rs/zerolog"
3435
)
@@ -51,6 +52,12 @@ var (
5152
}
5253
)
5354

55+
func init() {
56+
zerolog.TimestampFunc = func() time.Time {
57+
return time.Now().UTC()
58+
}
59+
}
60+
5461
// Service exposes the interfaces for a logger service
5562
// that supports different loggers with different levels.
5663
type Service interface {
@@ -79,7 +86,7 @@ type LoggerOutputOptions struct {
7986
}
8087

8188
func configureLogger(lg zerolog.ConsoleWriter) zerolog.ConsoleWriter {
82-
lg.TimeFormat = "2006-01-02T15:04:05-07:00"
89+
lg.TimeFormat = time.RFC3339
8390

8491
lg.FormatLevel = func(i interface{}) string {
8592
return fmt.Sprintf("|%s|", strings.ToUpper(fmt.Sprintf("%s", i)))

0 commit comments

Comments
 (0)