Skip to content

Commit

Permalink
fix: always debug slog gin
Browse files Browse the repository at this point in the history
  • Loading branch information
arturmon committed Oct 18, 2024
1 parent 3f034cd commit 3e1cea8
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/internal/app/rest.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func initializeGin(_ context.Context, cfg *model.Config, logger *logs.Logger) *g
router.Use(gin.Recovery())

router.Use(otelgin.Middleware("s3MediaStreamer"))
//router.Use(LoggingMiddleware(LoggingMiddlewareAdapter(logger)))

config := sloggin.Config{
WithSpanID: cfg.AppConfig.Web.Debug.WithSpanID,
WithTraceID: cfg.AppConfig.Web.Debug.WithTraceID,
Expand All @@ -46,8 +46,11 @@ func initializeGin(_ context.Context, cfg *model.Config, logger *logs.Logger) *g
WithRequestHeader: cfg.AppConfig.Web.Debug.WithRequestHeader,
WithResponseHeader: cfg.AppConfig.Web.Debug.WithResponseHeader,
}
router.Use(sloggin.New(logger.WithGroup("http")))
router.Use(sloggin.NewWithConfig(logger.Slog(), config))

if config.WithSpanID || config.WithTraceID || config.WithRequestBody || config.WithResponseBody || config.WithRequestHeader || config.WithResponseHeader {
router.Use(sloggin.New(logger.WithGroup("http")))
router.Use(sloggin.NewWithConfig(logger.Slog(), config))
}

logger.Info("prometheus initializing")

Expand Down

0 comments on commit 3e1cea8

Please sign in to comment.