Create a Logger class for BulkImports
Summary
We recently made improvements to logging in BulkImports/GitlabMigration (#368161 (closed)) and realized we have a lot of replicated code related to logging. It's principally in relation to payload, but we also log exceptions with a method replicated in several places.
We want to refactor all logging and implement a logger class similar to the Gitlab::GithubImport::Logger, then use this across all BulkImport classes.
It would likely be a new file in the existing /lib/bulk_imports/...
library.
Involved components
At the time of writing, these were the files where logging events happen:
/app/services/bulk_imports/create_pipeline_trackers_service.rb
/app/workers/bulk_imports/entity_worker.rb
/app/workers/bulk_imports/export_request_worker.rb
/app/workers/bulk_imports/pipeline_worker.rb
/lib/bulk_imports/common_pipelines/entity_finisher.rb
/lib/bulk_imports/pipeline/runner.rb
Technical Note:
The labkit-ruby upgrade (part of upgrading to Ruby 3.0) injects info into logs - to track which deployment stage we execute on (main, cny)- after the event leaves gitlab-rails. Since it writes the stage
log field, it overwrites any stage:
value, so don't use this value in the logs. See !111590 (merged)