From 9b203d6f3cc362a2fd97924e430ab70fff8696c2 Mon Sep 17 00:00:00 2001 From: "Steve H. Jung" Date: Sat, 22 May 2021 08:11:34 +0900 Subject: [PATCH 1/2] updated log time to have milliseconds --- server/logger.go | 4 ++++ server/util.go | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/server/logger.go b/server/logger.go index b0a2d2db5d..e77746eff4 100644 --- a/server/logger.go +++ b/server/logger.go @@ -13,6 +13,10 @@ type ZeroLogWrapper struct { zerolog.Logger } +func init() { + zerolog.TimeFieldFormat = zerolog.TimeFormatUnixMs +} + // Info implements Tendermint's Logger interface and logs with level INFO. A set // of key/value tuples may be provided to add context to the log. The number of // tuples must be even and the key of the tuple must be a string. diff --git a/server/util.go b/server/util.go index 389d2ac7c5..45354ee33e 100644 --- a/server/util.go +++ b/server/util.go @@ -136,7 +136,10 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command) error { var logWriter io.Writer if strings.ToLower(serverCtx.Viper.GetString(flags.FlagLogFormat)) == ostcfg.LogFormatPlain { - logWriter = zerolog.ConsoleWriter{Out: os.Stderr} + logWriter = zerolog.ConsoleWriter{ + Out: os.Stderr, + TimeFormat: "2006/01/02-15:04:05.999", + } } else { logWriter = os.Stderr } From c656f5f09cd4ea50232c1c4844cd459e5097f72d Mon Sep 17 00:00:00 2001 From: "Steve H. Jung" Date: Fri, 4 Jun 2021 13:58:17 +0900 Subject: [PATCH 2/2] style: for gofmt --- server/util.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/util.go b/server/util.go index 45354ee33e..602668817e 100644 --- a/server/util.go +++ b/server/util.go @@ -137,7 +137,7 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command) error { var logWriter io.Writer if strings.ToLower(serverCtx.Viper.GetString(flags.FlagLogFormat)) == ostcfg.LogFormatPlain { logWriter = zerolog.ConsoleWriter{ - Out: os.Stderr, + Out: os.Stderr, TimeFormat: "2006/01/02-15:04:05.999", } } else {