diff --git a/api/notfound.go b/api/notfound.go new file mode 100644 index 0000000..95fbe68 --- /dev/null +++ b/api/notfound.go @@ -0,0 +1,14 @@ +package api + +import ( + "net/http" + + "github.com/Sirupsen/logrus" +) + +type NotFound struct{} + +func (n NotFound) ServeHTTP(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(404) + logrus.Infof("%s %s not found.", r.Method, r.URL.String()) +} diff --git a/api/router.go b/api/router.go index e754256..9d0f6a3 100644 --- a/api/router.go +++ b/api/router.go @@ -12,5 +12,6 @@ func GetRouter(core core.Core, eventChannel chan *logrus.Entry) *mux.Router { r.HandleFunc("/autoscaler", AutoscalerList(core.Autoscalers)).Methods("GET") r.HandleFunc("/health", Health()).Methods("GET") r.HandleFunc("/events", Events(eventChannel)).Methods("GET") + r.NotFoundHandler = NotFound{} return r }