Add graceful stopping to server, and extend middleware and pipeline logic
This commit is contained in:
@@ -9,7 +9,16 @@ import (
|
||||
"github.com/urfave/negroni"
|
||||
)
|
||||
|
||||
func RequestLogger(next http.Handler) http.Handler {
|
||||
type RequestLogger struct{}
|
||||
|
||||
func (_ *RequestLogger) Stop() {
|
||||
log.Info().Msg("Stopped Logging")
|
||||
}
|
||||
|
||||
func (_ *RequestLogger) Manage() {
|
||||
}
|
||||
|
||||
func (_ *RequestLogger) Use(next http.Handler) http.Handler {
|
||||
log.Info().Msg("Enabling Logging")
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
start := time.Now()
|
||||
|
||||
Reference in New Issue
Block a user