From 731bcb9606078d377aa42e0442570556fa0bd8d7 Mon Sep 17 00:00:00 2001 From: Umputun Date: Sat, 9 Nov 2019 13:45:36 -0600 Subject: [PATCH] remove caller ip from logs on http errors --- backend/app/rest/httperrors.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/backend/app/rest/httperrors.go b/backend/app/rest/httperrors.go index 1cf1f71b..cefe9e21 100644 --- a/backend/app/rest/httperrors.go +++ b/backend/app/rest/httperrors.go @@ -56,14 +56,10 @@ func errDetailsMsg(r *http.Request, httpStatusCode int, err error, details strin if pc, file, line, ok := runtime.Caller(2); ok { fnameElems := strings.Split(file, "/") funcNameElems := strings.Split(runtime.FuncForPC(pc).Name(), "/") - srcFileInfo = fmt.Sprintf(" [caused by %s:%d %s]", strings.Join(fnameElems[len(fnameElems)-3:], "/"), + srcFileInfo = fmt.Sprintf(" [%s:%d %s]", strings.Join(fnameElems[len(fnameElems)-3:], "/"), line, funcNameElems[len(funcNameElems)-1]) } - remoteIP := r.RemoteAddr - if pos := strings.Index(remoteIP, ":"); pos >= 0 { - remoteIP = remoteIP[:pos] - } return fmt.Sprintf("%s - %v - %d (%d) - %s%s - %s%s", - details, err, httpStatusCode, errCode, uinfoStr, remoteIP, q, srcFileInfo) + details, err, httpStatusCode, errCode, uinfoStr, q, srcFileInfo) }