feat: 设置时区为北京时间

This commit is contained in:
余泓铮
2025-08-13 15:21:42 +08:00
parent 07bfabd5b6
commit 07395a2f9e
2 changed files with 6 additions and 2 deletions

View File

@@ -1 +1 @@
v5.0.0-250812
v5.0.0-250813

View File

@@ -18,7 +18,11 @@ func InitLogger(logLevel string, logJSON bool, logFile bool) {
// Error Logging with Stacktrace
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
// set log timestamp precise to milliseconds
// set log timestamp precise to milliseconds with Beijing timezone (UTC+8)
beijingLoc, _ := time.LoadLocation("Asia/Shanghai")
zerolog.TimestampFunc = func() time.Time {
return time.Now().In(beijingLoc)
}
zerolog.TimeFieldFormat = "2006-01-02T15:04:05.999Z0700"
// init log writers