ginLogger

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 License: MIT Imports: 4 Imported by: 0

README

logs-gin-go

Logger fo gin gonic

Usage

Pass logrus instance to constructor.

package main

import (
	"github.com/gin-gonic/gin"
	ginLogger "github.com/spacetab-io/logs-gin-go"
)

func main() {
	r := gin.New()
	r.Use(ginLogger.NewLogger(logrus.New()), gin.Recovery())

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

Licence

The software is provided under MIT Licence.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLogger

func NewLogger(l *logrus.Logger) gin.HandlerFunc

NewLogger logs gin gonic actions

Types

This section is empty.

Jump to

Keyboard shortcuts

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