瀏覽代碼

feat: change logger to traceLogger for getting traceId when recovering (#374)

Allen Liu 3 年之前
父節點
當前提交
3b683fd498
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      rest/internal/log.go

+ 2 - 2
rest/internal/log.go

@@ -54,12 +54,12 @@ func (lc *LogCollector) takeAll() []string {
 
 // Error logs the given v along with r in error log.
 func Error(r *http.Request, v ...interface{}) {
-	logx.ErrorCaller(1, format(r, v...))
+	logx.WithContext(r.Context()).Error(v)
 }
 
 // Errorf logs the given v with format along with r in error log.
 func Errorf(r *http.Request, format string, v ...interface{}) {
-	logx.ErrorCaller(1, formatf(r, format, v...))
+	logx.WithContext(r.Context()).Errorf(format, v)
 }
 
 // Info logs the given v along with r in access log.