Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cmd/heimdalld/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package heimdalld

import (
"os"
"time"

"cosmossdk.io/log"
"github.com/cometbft/cometbft/cmd/cometbft/commands"
Expand Down Expand Up @@ -137,6 +136,12 @@ func NewRootCmd() *cobra.Command {
}

logNoColor := serverCtx.Viper.GetBool(flags.FlagLogNoColor)
// Store timestamps with millisecond precision so that log lines carry
// sub-second granularity. Without this, zerolog stores the timestamp
// as RFC3339 (second precision) before the ConsoleWriter ever gets a
// chance to format it, resulting in second-only output.
// Using 3 decimal places ("000") matches bor's log timestamp format.
zerolog.TimeFieldFormat = "2006-01-02T15:04:05.000Z07:00"
var logOpts []log.Option
if serverCtx.Viper.GetString(flags.FlagLogFormat) == flags.OutputFormatJSON {
logOpts = append(logOpts, log.OutputJSONOption())
Expand All @@ -145,7 +150,7 @@ func NewRootCmd() *cobra.Command {
}
logOpts = append(logOpts,
log.LevelOption(logLevel),
log.TimeFormatOption(time.RFC3339Nano),
log.TimeFormatOption("2006-01-02T15:04:05.000Z07:00"),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we can use a constant here, since it's duplicated from line 144

)

serverCtx.Logger = log.NewLogger(cmd.OutOrStdout(), logOpts...).With(log.ModuleKey, "server")
Expand Down
2 changes: 1 addition & 1 deletion helper/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ func InitHeimdallConfigWith(homeDir string, heimdallConfigFileFromFlag string) {
}
logOpts = append(logOpts,
logger.LevelOption(logLevel),
logger.TimeFormatOption(time.RFC3339Nano),
logger.TimeFormatOption("2006-01-02T15:04:05.000Z07:00"),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

)

Logger = logger.NewLogger(GetLogsWriter(conf.Custom.LogsWriterFile), logOpts...)
Expand Down
Loading