Commit 5c59b053 authored by Nick Thomas's avatar Nick Thomas

Merge branch '320-improve-image-scaler-logs' into 'master'

Consistent logging in image resizer module

Closes #320

See merge request gitlab-org/gitlab-workhorse!652
parents efe5733d b09946f3
---
title: Improve logging for image scaler
merge_request: 652
author:
type: other
...@@ -37,10 +37,19 @@ func CaptureAndFail(w http.ResponseWriter, r *http.Request, err error, msg strin ...@@ -37,10 +37,19 @@ func CaptureAndFail(w http.ResponseWriter, r *http.Request, err error, msg strin
LogError(r, err) LogError(r, err)
} }
func CaptureAndFailWithFields(w http.ResponseWriter, r *http.Request, err error, msg string, code int, fields log.Fields) {
http.Error(w, msg, code)
LogErrorWithFields(r, err, fields)
}
func Fail500(w http.ResponseWriter, r *http.Request, err error) { func Fail500(w http.ResponseWriter, r *http.Request, err error) {
CaptureAndFail(w, r, err, "Internal server error", http.StatusInternalServerError) CaptureAndFail(w, r, err, "Internal server error", http.StatusInternalServerError)
} }
func Fail500WithFields(w http.ResponseWriter, r *http.Request, err error, fields log.Fields) {
CaptureAndFailWithFields(w, r, err, "Internal server error", http.StatusInternalServerError, fields)
}
func RequestEntityTooLarge(w http.ResponseWriter, r *http.Request, err error) { func RequestEntityTooLarge(w http.ResponseWriter, r *http.Request, err error) {
CaptureAndFail(w, r, err, "Request Entity Too Large", http.StatusRequestEntityTooLarge) CaptureAndFail(w, r, err, "Request Entity Too Large", http.StatusRequestEntityTooLarge)
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment