From 15df13c7e664528dceb22485c350ad6d38ec5c4e Mon Sep 17 00:00:00 2001 From: hidewrong Date: Fri, 17 Jan 2025 23:59:29 +0800 Subject: [PATCH] Signed-off-by: hidewrong (#14792) Signed-off-by: hidewrong --- changelog/hidewrong_use_time.DateTime.md | 2 ++ cmd/beacon-chain/main.go | 3 ++- cmd/client-stats/main.go | 2 +- cmd/validator/main.go | 3 ++- tools/pcli/main.go | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 changelog/hidewrong_use_time.DateTime.md diff --git a/changelog/hidewrong_use_time.DateTime.md b/changelog/hidewrong_use_time.DateTime.md new file mode 100644 index 0000000000..811cf555e8 --- /dev/null +++ b/changelog/hidewrong_use_time.DateTime.md @@ -0,0 +1,2 @@ +### Changed +- Refactor `2006-01-02 15:04:05` to `time.DateTime` \ No newline at end of file diff --git a/cmd/beacon-chain/main.go b/cmd/beacon-chain/main.go index c47348f35a..43d0aa8af7 100644 --- a/cmd/beacon-chain/main.go +++ b/cmd/beacon-chain/main.go @@ -7,6 +7,7 @@ import ( "os" "path/filepath" runtimeDebug "runtime/debug" + "time" gethlog "github.com/ethereum/go-ethereum/log" golog "github.com/ipfs/go-log/v2" @@ -163,7 +164,7 @@ func before(ctx *cli.Context) error { switch format { case "text": formatter := new(prefixed.TextFormatter) - formatter.TimestampFormat = "2006-01-02 15:04:05" + formatter.TimestampFormat = time.DateTime formatter.FullTimestamp = true // If persistent log files are written - we disable the log messages coloring because diff --git a/cmd/client-stats/main.go b/cmd/client-stats/main.go index 9962947b66..fd56b7e5f2 100644 --- a/cmd/client-stats/main.go +++ b/cmd/client-stats/main.go @@ -60,7 +60,7 @@ func main() { switch format { case "text": formatter := new(prefixed.TextFormatter) - formatter.TimestampFormat = "2006-01-02 15:04:05" + formatter.TimestampFormat = time.DateTime formatter.FullTimestamp = true // If persistent log files are written - we disable the log messages coloring because // the colors are ANSI codes and seen as gibberish in the log files. diff --git a/cmd/validator/main.go b/cmd/validator/main.go index 1177b960a1..a8c4697514 100644 --- a/cmd/validator/main.go +++ b/cmd/validator/main.go @@ -8,6 +8,7 @@ import ( "os" "path/filepath" runtimeDebug "runtime/debug" + "time" joonix "github.com/joonix/log" "github.com/pkg/errors" @@ -153,7 +154,7 @@ func main() { switch format { case "text": formatter := new(prefixed.TextFormatter) - formatter.TimestampFormat = "2006-01-02 15:04:05" + formatter.TimestampFormat = time.DateTime formatter.FullTimestamp = true // If persistent log files are written - we disable the log messages coloring because // the colors are ANSI codes and seen as gibberish in the log files. diff --git a/tools/pcli/main.go b/tools/pcli/main.go index 65667e1189..810748af56 100644 --- a/tools/pcli/main.go +++ b/tools/pcli/main.go @@ -299,7 +299,7 @@ var stateTransitionCommand = &cli.Command{ func main() { customFormatter := new(prefixed.TextFormatter) - customFormatter.TimestampFormat = "2006-01-02 15:04:05" + customFormatter.TimestampFormat = time.DateTime customFormatter.FullTimestamp = true log.SetFormatter(customFormatter) app := cli.App{}