gokitlog

package module
v0.0.0-...-0eea223 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2017 License: GPL-3.0 Imports: 2 Imported by: 0

README

gin-gokitlog CircleCI GoReport GoDoc

Gin middleware to use gokit log

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorLogger

func ErrorLogger() gin.HandlerFunc

ErrorLogger returns an ErrorLoggerT with parameter gin.ErrorTypeAny

func ErrorLoggerT

func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc

ErrorLoggerT returns an ErrorLoggerT middleware with the given type gin.ErrorType.

func LogAdapter

func LogAdapter(fn func(c *gin.Context)) gin.HandlerFunc

LogAdapter returns a new LogAdapter wrapper around the passed logger. It formats the log entries similar to http://godoc.org/github.com/gin-gonic/gin#Logger does.

Example:

       router := gin.New()
       router.Use(gokitlog.LogAdapter(func(c *gin.Context){
				 latency,_ := c.Get("latency")
              logger.Log(
					"latency",latency,"clientIP",c.ClientIP(),
					"status",c.Writer.Status(),"err",c.Errors.String())
		  })

Types

This section is empty.

Jump to

Keyboard shortcuts

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