logrusmiddleware

package module
v0.0.0-...-047c03d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2018 License: MIT Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

GoDoc

logrus-middleware

Simple logging middleware for Go using logrus

"Normal" net/http middleware for Go for logging.

See the example

Based on: https://github.com/meatballhat/negroni-logrus

Documentation

Overview

Package logrusmiddleware is a simple net/http middleware for logging using logrus

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is the actual middleware that handles logging

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(rw http.ResponseWriter, r *http.Request)

ServeHTTP calls the "real" handler and logs using the logger

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
}

Middleware is a middleware handler for HTTP logging

func (*Middleware) Handler

func (m *Middleware) Handler(h http.Handler, component string) *Handler

Handler create a new handler. component, if set, is emitted in the log messages.

type ResponseWriter

type ResponseWriter struct {
	http.ResponseWriter
	// contains filtered or unexported fields
}

ResponseWriter exposes the number of

func (*ResponseWriter) Write

func (w *ResponseWriter) Write(b []byte) (n int, err error)

Write is a wrapper for the "real" ResponseWriter.Write

func (*ResponseWriter) WriteHeader

func (w *ResponseWriter) WriteHeader(s int)

WriteHeader is a wrapper around ResponseWriter.WriteHeader

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL