ginlogrus

package module
v0.0.0-...-2c78543 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2021 License: MIT Imports: 7 Imported by: 122 modules, 108 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

gin-logrus

Logrus logger middleware for Gin

golang gin middleware logrus logger

Usage

import (
  "github.com/sirupsen/logrus"
  "github.com/toorop/gin-logrus"
  "github.com/gin-gonic/gin"

log := logrus.New()
// hooks, config,...

r := gin.New()
r.Use(ginlogrus.Logger(log), gin.Recovery())

// pingpong
r.GET("/ping", func(c *gin.Context) {
	c.Data(200, "text/plain", []byte("pong"))
})

r.Run("127.0.0.1:8080")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Logger

func Logger(logger logrus.FieldLogger, notLogged ...string) gin.HandlerFunc

Logger is the logrus logger handler

Types

This section is empty.

Jump to

Keyboard shortcuts

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