mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-08-28 13:03:22 +08:00
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
// @Copyright Copyright (c) 2023 HotGo CLI
|
||||
// @Author Ms <133814250@qq.com>
|
||||
// @License https://github.com/bufanyun/hotgo/blob/master/LICENSE
|
||||
//
|
||||
package hook
|
||||
|
||||
import (
|
||||
@@ -21,14 +20,16 @@ func (s *sHook) accessLog(r *ghttp.Request) {
|
||||
if r.IsFileRequest() {
|
||||
return
|
||||
}
|
||||
var ctx = r.Context()
|
||||
var ctx = contexts.Detach(r.Context())
|
||||
modelCtx := contexts.Get(ctx)
|
||||
if modelCtx == nil {
|
||||
return
|
||||
}
|
||||
|
||||
// 计算运行耗时
|
||||
contexts.SetTakeUpTime(ctx, gtime.TimestampMilli()-r.EnterTime)
|
||||
contexts.SetDataMap(ctx, g.Map{
|
||||
"request.takeUpTime": gtime.TimestampMilli() - r.EnterTime,
|
||||
// ...
|
||||
})
|
||||
|
||||
simple.SafeGo(ctx, func(ctx context.Context) {
|
||||
if err := service.SysLog().AutoLog(ctx); err != nil {
|
||||
|
Reference in New Issue
Block a user