From ec199162dc47d01df166faf25fe932e48281a36c Mon Sep 17 00:00:00 2001 From: mmetc <92726601+mmetc@users.noreply.github.com> Date: Fri, 24 Nov 2023 14:59:28 +0100 Subject: [PATCH] iso8601: use yyyy-mm-dd in log timestamps instead of dd-mm-yyyy (#2564) Co-authored-by: Thibault "bui" Koechlin --- cmd/crowdsec-cli/main.go | 2 +- pkg/types/utils.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/crowdsec-cli/main.go b/cmd/crowdsec-cli/main.go index e99fd53ab..c3a475f70 100644 --- a/cmd/crowdsec-cli/main.go +++ b/cmd/crowdsec-cli/main.go @@ -134,7 +134,7 @@ var ( func main() { // set the formatter asap and worry about level later - logFormatter := &log.TextFormatter{TimestampFormat: "02-01-2006 15:04:05", FullTimestamp: true} + logFormatter := &log.TextFormatter{TimestampFormat: "2006-01-02 15:04:05", FullTimestamp: true} log.SetFormatter(logFormatter) if err := fflag.RegisterAllFeatures(); err != nil { diff --git a/pkg/types/utils.go b/pkg/types/utils.go index 8a49c9d32..b58eda99b 100644 --- a/pkg/types/utils.go +++ b/pkg/types/utils.go @@ -46,7 +46,7 @@ func SetDefaultLoggerConfig(cfgMode string, cfgFolder string, cfgLevel log.Level } logLevel = cfgLevel log.SetLevel(logLevel) - logFormatter = &log.TextFormatter{TimestampFormat: "02-01-2006 15:04:05", FullTimestamp: true, ForceColors: forceColors} + logFormatter = &log.TextFormatter{TimestampFormat: "2006-01-02 15:04:05", FullTimestamp: true, ForceColors: forceColors} log.SetFormatter(logFormatter) return nil }