package task import ( "fmt" "time" "gd_management_gateway/common.in/span" "github.com/astaxie/beego/context" "go.uber.org/zap" ) func printAccessLog(ctx *context.Context, startTime uint64, status string, spanID span.SpanID) { if l != nil { endTime := uint64(time.Now().UnixNano()) l.Info(ctx.Input.Method(), zap.Uint64("trace_id", uint64(spanID.Trace)), zap.Uint64("span_id", uint64(spanID.Span)), zap.Uint64("parent_id", uint64(spanID.Parent)), zap.String("status", status), zap.String("elapsed", fmt.Sprintf("%fms", float64(endTime-startTime)/1000000)), zap.String("ip", ctx.Input.IP()), zap.String("uri", ctx.Input.URI()), zap.String("body", string(ctx.Input.RequestBody))) } }