Skip to content

Commit 718e8ed

Browse files
author
Przemysław Stępień
authored
feat: Add logger to context (#2125)
#### Summary <!-- 🎉 Thank you for making CloudQuery awesome by submitting a PR 🎉 --> This PR aims to add pre-configured logger support for source plugins by pushing it to the resolver context. --- Use the following steps to ensure your PR is ready to be reviewed - [ ] Read the [contribution guidelines](../blob/main/CONTRIBUTING.md) 🧑‍🎓 - [ ] Run `go fmt` to format your code 🖊 - [ ] Lint your changes via `golangci-lint run` 🚨 (install golangci-lint [here](https://golangci-lint.run/usage/install/#local-installation)) - [ ] Update or add tests 🧪 - [ ] Ensure the status checks below are successful ✅
1 parent 8f370f8 commit 718e8ed

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

scheduler/queue/worker.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func (w *worker) resolveTable(ctx context.Context, table *schema.Table, client s
7575
)
7676
defer span.End()
7777
logger := w.logger.With().Str("table", table.Name).Str("client", clientName).Logger()
78+
ctx = logger.WithContext(ctx)
7879
startTime := time.Now()
7980
if parent == nil { // Log only for root tables, otherwise we spam too much.
8081
logger.Info().Msg("top level table resolver started")

scheduler/scheduler_dfs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ func (s *syncClient) resolveTableDfs(ctx context.Context, table *schema.Table, c
8787
)
8888
defer span.End()
8989
logger := s.logger.With().Str("table", table.Name).Str("client", clientName).Logger()
90+
ctx = logger.WithContext(ctx)
9091

9192
startTime := time.Now()
9293
if parent == nil { // Log only for root tables, otherwise we spam too much.

0 commit comments

Comments
 (0)