gin_logger.go 409 B

123456789101112131415161718192021
  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. lazyInitialize()
  9. return ginzap.GinzapWithConfig(logger, &ginzap.Config{
  10. TimeFormat: time.RFC3339,
  11. UTC: true,
  12. SkipPaths: skipPaths,
  13. })
  14. }
  15. func GinRecovery() gin.HandlerFunc {
  16. lazyInitialize()
  17. return ginzap.RecoveryWithZap(logger, true)
  18. }