From 3b683fd498cf6aee0a361291719e022c860c237f Mon Sep 17 00:00:00 2001 From: Allen Liu Date: Sun, 5 Sep 2021 22:40:10 +0800 Subject: [PATCH] feat: change logger to traceLogger for getting traceId when recovering (#374) --- 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 0e100460..f169eebb 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.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.