lib/httpserver: log the caller of httpserver.Errorf

Previously log message contained `httpserver.Errorf`, not it contains the caller of `httpserver.Errorf`, which is more useful.
This commit is contained in:
Aliaksandr Valialkin
2020-01-25 20:16:47 +02:00
parent 9df5b2d1c3
commit f6baee6efe
2 changed files with 19 additions and 13 deletions

View File

@@ -418,7 +418,7 @@ var (
// Errorf writes formatted error message to w and to logger.
func Errorf(w http.ResponseWriter, format string, args ...interface{}) {
errStr := fmt.Sprintf(format, args...)
logger.Errorf("%s", errStr)
logger.ErrorfSkipframes(1, "%s", errStr)
// Extract statusCode from args
statusCode := http.StatusBadRequest