cloudapi: Add extra logging & improve existing
Use different logging levels depending on situation Log HTTP 5xx errors to stdout with internal error details when possible
This commit is contained in:
parent
179009fec4
commit
27ca55372a
2 changed files with 17 additions and 7 deletions
|
|
@ -219,7 +219,14 @@ func (s *Server) HTTPErrorHandler(echoError error, c echo.Context) {
|
|||
apiErr := APIError(code, sec, c)
|
||||
|
||||
if sec.httpStatus == http.StatusInternalServerError {
|
||||
c.Logger().Errorf("Internal server error. Code: %s, OperationId: %s", apiErr.Code, apiErr.OperationId)
|
||||
internalError, ok := echoError.(*echo.HTTPError)
|
||||
errMsg := fmt.Sprintf("Internal server error. Code: %s, OperationId: %s", apiErr.Code, apiErr.OperationId)
|
||||
|
||||
if ok {
|
||||
errMsg += fmt.Sprintf(", InternalError: %v", internalError)
|
||||
}
|
||||
|
||||
c.Logger().Error(errMsg)
|
||||
}
|
||||
|
||||
if c.Request().Method == http.MethodHead {
|
||||
|
|
@ -237,6 +244,7 @@ func (s *Server) HTTPErrorHandler(echoError error, c echo.Context) {
|
|||
|
||||
he, ok := echoError.(*echo.HTTPError)
|
||||
if !ok {
|
||||
c.Logger().Errorf("ErrorNotHTTPError %v", echoError)
|
||||
doResponse(ErrorNotHTTPError, c)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue