Skip to content

Commit

Permalink
updated log time to have milliseconds (#224)
Browse files Browse the repository at this point in the history
* updated log time to have milliseconds

* style: for gofmt
  • Loading branch information
iproudhon committed Jun 4, 2021
1 parent 2a5a2d2 commit 95b22d3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions server/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 95b22d3

Please sign in to comment.