mirror of
https://github.com/httprunner/httprunner.git
synced 2026-06-08 17:29:34 +08:00
Merge branch 'feat/time_location' into 'master'
feat: 设置时区为北京时间 See merge request iesqa/httprunner!154
This commit is contained in:
@@ -1 +1 @@
|
|||||||
v5.0.0-250812
|
v5.0.0-250813
|
||||||
|
|||||||
@@ -18,7 +18,11 @@ func InitLogger(logLevel string, logJSON bool, logFile bool) {
|
|||||||
// Error Logging with Stacktrace
|
// Error Logging with Stacktrace
|
||||||
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
|
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"
|
zerolog.TimeFieldFormat = "2006-01-02T15:04:05.999Z0700"
|
||||||
|
|
||||||
// init log writers
|
// init log writers
|
||||||
|
|||||||
Reference in New Issue
Block a user