Skip to content

Instantly share code, notes, and snippets.

@rkhmelyuk
Last active February 18, 2018 03:27
Show Gist options
  • Save rkhmelyuk/c5e58bab094d3be5e2e8e0283a01a921 to your computer and use it in GitHub Desktop.
Save rkhmelyuk/c5e58bab094d3be5e2e8e0283a01a921 to your computer and use it in GitHub Desktop.
router := gin.New()
router.Use(StatusMetrics()) // now we will collect metric for number of reples for a status
if logFile != nil {
router.Use(gin.LoggerWithWriter(logFile))
router.Use(gin.RecoveryWithWriter(logFile))
} else {
router.Use(gin.Logger())
router.Use(gin.Recovery())
}
router.Use(Metrics()) // now we will publish metrics for each API call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment