Files
gooseek/backend/pkg/middleware/logging.go
home 06fe57c765 feat: Go backend, enhanced search, new widgets, Docker deploy
Major changes:
- Add Go backend (backend/) with microservices architecture
- Enhanced master-agents-svc: reranker, content-classifier, stealth-crawler,
  proxy-manager, media-search, fastClassifier, language detection
- New web-svc widgets: KnowledgeCard, ProductCard, ProfileCard, VideoCard,
  UnifiedCard, CardGallery, InlineImageGallery, SourcesPanel, RelatedQuestions
- Improved discover-svc with discover-db integration
- Docker deployment improvements (Caddyfile, vendor.sh, BUILD.md)
- Library-svc: project_id schema migration
- Remove deprecated finance-svc and travel-svc
- Localization improvements across services

Made-with: Cursor
2026-02-27 04:15:32 +03:00

50 lines
861 B
Go

package middleware
import (
"time"
"github.com/gofiber/fiber/v2"
"go.uber.org/zap"
)
type LoggingConfig struct {
Logger *zap.Logger
SkipPaths []string
}
func Logging(config LoggingConfig) fiber.Handler {
logger := config.Logger
if logger == nil {
logger, _ = zap.NewProduction()
}
skipPaths := make(map[string]bool)
for _, path := range config.SkipPaths {
skipPaths[path] = true
}
return func(c *fiber.Ctx) error {
path := c.Path()
if skipPaths[path] {
return c.Next()
}
start := time.Now()
err := c.Next()
duration := time.Since(start)
logger.Info("request",
zap.String("method", c.Method()),
zap.String("path", path),
zap.Int("status", c.Response().StatusCode()),
zap.Duration("latency", duration),
zap.String("ip", c.IP()),
zap.String("user-agent", c.Get("User-Agent")),
)
return err
}
}