mirror of
https://git.vectorsigma.ru/public/atlantis.git
synced 2026-07-28 21:38:25 +00:00
* set version in one place * rename ExecutionContext to CommandContext * delete unneeded PullRequestContext since it just duplicated what is in CommandContext * split fields inside CommandContext into Repo, PullRequest, and User models * clean up unused fields * remove base_executor stuff which was trying to do inheritance in go and didn't get us anywhere * clean up unused code and assets * created a locking.Client that creates the Keys that are used on the front-end. This allows the backends to store the locks any way they like as long as they support the interface
25 lines
645 B
Go
25 lines
645 B
Go
package middleware
|
|
|
|
import (
|
|
"github.com/hootsuite/atlantis/logging"
|
|
"github.com/urfave/negroni"
|
|
"net/http"
|
|
)
|
|
|
|
func NewNon200Logger(logger *logging.SimpleLogger) *FailedRequestLogger {
|
|
return &FailedRequestLogger{logger}
|
|
}
|
|
|
|
// FailedRequestLogger logs the request when a response code >= 400 is sent
|
|
type FailedRequestLogger struct {
|
|
logger *logging.SimpleLogger
|
|
}
|
|
|
|
func (l *FailedRequestLogger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
|
|
next(rw, r)
|
|
res := rw.(negroni.ResponseWriter)
|
|
if res.Status() >= 400 {
|
|
l.logger.Info("%s %s - Response code %d", r.Method, r.URL.RequestURI(), res.Status())
|
|
}
|
|
}
|