Explorar el Código

rest log with context (#998)

Kevin Wan hace 3 años
padre
commit
6476da4a18
Se han modificado 1 ficheros con 2 adiciones y 2 borrados
  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.WithContext(r.Context()).Error(v)
+	logx.WithContext(r.Context()).Error(format(r, v...))
 }
 
 // Errorf logs the given v with format along with r in error log.
 func Errorf(r *http.Request, format string, v ...interface{}) {
-	logx.WithContext(r.Context()).Errorf(format, v)
+	logx.WithContext(r.Context()).Error(formatf(r, format, v...))
 }
 
 // Info logs the given v along with r in access log.