From 6476da4a1841bf56a6efd2171bcbd976b2d9a2f3 Mon Sep 17 00:00:00 2001 From: Kevin Wan Date: Sun, 5 Sep 2021 22:58:42 +0800 Subject: [PATCH] rest log with context (#998) --- rest/internal/log.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rest/internal/log.go b/rest/internal/log.go index f169eebb..2756f33f 100644 --- a/rest/internal/log.go +++ b/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.