gin_logger.go 401 B

12345678910111213141516171819
  1. package fslog
  2. import (
  3. ginzap "github.com/gin-contrib/zap"
  4. "github.com/gin-gonic/gin"
  5. "time"
  6. )
  7. func GinLogger(skipPaths []string) gin.HandlerFunc {
  8. return ginzap.GinzapWithConfig(log.logger.Desugar(), &ginzap.Config{
  9. TimeFormat: time.RFC3339,
  10. UTC: true,
  11. SkipPaths: skipPaths,
  12. })
  13. }
  14. func GinRecovery() gin.HandlerFunc {
  15. return ginzap.RecoveryWithZap(log.logger.Desugar(), true)
  16. }