Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AfterFunc ¶
AfterFunc is the func type used to modify or replace the *logrus.Entry after calling the next func in the middleware chain
type BeforeFunc ¶
BeforeFunc is the func type used to modify or replace the *logrus.Entry prior to calling the next func in the middleware chain
type Middleware ¶
type Middleware struct { // Logger is the log.Logger instance used to log messages with the Logger middleware Logger *logrus.Logger // Name is the name of the application as recorded in latency metrics Name string Before func(*logrus.Entry, *http.Request, string) *logrus.Entry After func(*logrus.Entry, negroni.ResponseWriter, time.Duration, string) *logrus.Entry sync.RWMutex // contains filtered or unexported fields }
Middleware is a middleware handler that logs the request as it goes in and the response as it goes out.
func NewCustomMiddleware ¶
NewCustomMiddleware builds a *Middleware with the given level and formatter
func NewMiddlewareFromLogger ¶
func NewMiddlewareFromLogger(logger *logrus.Logger, name string) *Middleware
NewMiddlewareFromLogger returns a new *Middleware which writes to a given logrus logger.
func (*Middleware) ExcludePaths ¶
func (m *Middleware) ExcludePaths(paths ...string) *Middleware
ExcludePaths adds new URL paths to be ignored during logging. The URL u is parsed, hence the returned error
func (*Middleware) ServeHTTP ¶
func (m *Middleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
func (*Middleware) SetLogStarting ¶
func (m *Middleware) SetLogStarting(v bool)
SetLogStarting accepts a bool to control the logging of "started handling request" prior to passing to the next middleware