Importers: standardise file logging

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

Existing behaviour

  • Gitlab::Import::Logger inherits from Gitlab::JsonLogger to log JSON to importer.log`.
  • These loggers inherit from Gitlab::Import::Logger and only set the importer name:
    • Gitlab::GithubImport::Logger
    • Gitlab::BitbucketImport::Logger
    • Gitlab::BitbucketServerImport::Logger
  • These loggers inherit from Gitlab::Import::Logger and add significant functionality:
    • BulkImports::Logger: Adds with_entity and with_tracker to build JSON payload based on current import.
  • The following importers reference Gitlab::Import::Logger directly:
    • Gitlab::JiraImport
  • The following importers don't seem to do significant file logging:
    • Gitlab::FogbugzImport
    • Gitlab::GithubGistsImport
    • Gitlab::LegacyGithubImport

Proposal

Import::Framework::Logger will be responsible for all file logging behavior across our importers.

  • It logs JSON to an output file.
  • It raises an error in development if key identifiers are missing.1

Since most of our logging behaviour is covered by Gitlab::Import::Logger, I think our approach to file-based logging is already pretty well standardised.

  1. #430051 (comment 1698178259)

Edited by 🤖 GitLab Bot 🤖