Merge branch 'feat/time_location' into 'master'

feat: 设置时区为北京时间

See merge request iesqa/httprunner!154
This commit is contained in:
余泓铮
2025-08-13 11:20:12 +00:00
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