negroni-logrus: github.com/meatballhat/negroni-logrus Index | Files

package negronilogrus

import "github.com/meatballhat/negroni-logrus"

Index

Package Files

middleware.go

func DefaultAfter Uses

func DefaultAfter(entry *logrus.Entry, res negroni.ResponseWriter, latency time.Duration, name string) *logrus.Entry

DefaultAfter is the default func assigned to *Middleware.After

func DefaultBefore Uses

func DefaultBefore(entry *logrus.Entry, req *http.Request, remoteAddr string) *logrus.Entry

DefaultBefore is the default func assigned to *Middleware.Before

type AfterFunc Uses

type AfterFunc func(*logrus.Entry, negroni.ResponseWriter, time.Duration, string) *logrus.Entry

AfterFunc is the func type used to modify or replace the *logrus.Entry after calling the next func in the middleware chain

type BeforeFunc Uses

type BeforeFunc func(*logrus.Entry, *http.Request, string) *logrus.Entry

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 Uses

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
    // 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 Uses

func NewCustomMiddleware(level logrus.Level, formatter logrus.Formatter, name string) *Middleware

NewCustomMiddleware builds a *Middleware with the given level and formatter

func NewMiddleware Uses

func NewMiddleware() *Middleware

NewMiddleware returns a new *Middleware, yay!

func NewMiddlewareFromLogger Uses

func NewMiddlewareFromLogger(logger *logrus.Logger, name string) *Middleware

NewMiddlewareFromLogger returns a new *Middleware which writes to a given logrus logger.

func (*Middleware) ExcludeURL Uses

func (m *Middleware) ExcludeURL(u string) error

ExcludeURL adds a new URL u to be ignored during logging. The URL u is parsed, hence the returned error

func (*Middleware) ExcludedURLs Uses

func (m *Middleware) ExcludedURLs() []string

ExcludedURLs returns the list of excluded URLs for this middleware

func (*Middleware) ServeHTTP Uses

func (m *Middleware) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)

func (*Middleware) SetLogStarting Uses

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

Package negronilogrus imports 6 packages (graph) and is imported by 88 packages. Updated 2017-08-08. Refresh now. Tools for package owners.