From 6b7e021152b64444dcd8d4a3949ba59726f3f585 Mon Sep 17 00:00:00 2001 From: Nathan Villaescusa Date: Mon, 18 Mar 2024 14:35:51 -0700 Subject: [PATCH] Change logger --- lib/rdbms/scan/scan.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/rdbms/scan/scan.go b/lib/rdbms/scan/scan.go index 528152c1..5be611c5 100644 --- a/lib/rdbms/scan/scan.go +++ b/lib/rdbms/scan/scan.go @@ -7,6 +7,7 @@ import ( "github.com/artie-labs/reader/lib/rdbms/primary_key" "github.com/artie-labs/transfer/lib/retry" + "gorm.io/gorm/logger" ) const ( @@ -106,12 +107,7 @@ func (s *Scanner) Next() ([]map[string]any, error) { func (s *Scanner) scan() ([]map[string]any, error) { query, parameters := s.adapter.BuildQuery(s.primaryKeys.Keys(), s.isFirstBatch, s.batchSize) - - logger := slog.With(slog.String("query", query)) - if len(parameters) > 0 { - logger = logger.With(slog.Any("parameters", parameters)) - } - logger.Info("Scan query") + logger.Info("Scan query", slog.String("query", query), slog.Any("parameters", parameters)) rows, err := retry.WithRetriesAndResult(s.retryCfg, func(_ int, _ error) (*sql.Rows, error) { return s.db.Query(query, parameters...)