Skip to content

chandraanwar91/gin-logger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logger

Gin middleware/handler to logger url path using rs/zerolog.

Example:

package main

import (
	"github.com/chandraanwar91/logger"
	"github.com/gin-gonic/gin"
)

func main() {
	//setting confing
	config := logger.Config{
		SkipPath:               []string{"/application/health"}, // if we want to skip log
		SkipLoggedPathResponse: []string{"/application/get-credential"}, //if we don't want to log body response
	}

	r := gin.New()

	// Add a logger middleware, which:
	//   - Logs all requests, like a combined access and error log.
	//   - Logs to stdout.
	r.Use(logger.SetLogger(config))

	// Listen and Server in 0.0.0.0:8080
	r.Run(":8080")
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages