diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-08-18 11:17:02 +0300 |
commit | b39512ed755239198a9c294b6a45e65c05900235 (patch) | |
tree | d234a3efade1de67c46b9e5a38ce813627726aa7 /lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb | |
parent | d31474cf3b17ece37939d20082b07f6657cc79a9 (diff) |
Add latest changes from gitlab-org/gitlab@15-3-stable-eev15.3.0-rc42
Diffstat (limited to 'lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb')
-rw-r--r-- | lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb b/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb index e38496ecf67..34e75755dec 100644 --- a/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb +++ b/lib/gitlab/import_export/after_export_strategies/base_after_export_strategy.rb @@ -12,12 +12,13 @@ module Gitlab private - attr_reader :project, :current_user, :lock_file + attr_reader :project, :current_user, :lock_file, :logger public def initialize(attributes = {}) @options = attributes + @logger = Gitlab::Export::Logger.build end def method_missing(method, *args) @@ -43,6 +44,10 @@ module Gitlab true rescue StandardError => e + payload = { message: "After export strategy failed" } + Gitlab::ExceptionLogFormatter.format!(e, payload) + log_error(payload) + project.import_export_shared.error(e) false ensure @@ -108,6 +113,18 @@ module Gitlab def log_validation_errors errors.full_messages.each { |msg| project.import_export_shared.add_error_message(msg) } end + + def log_info(params) + logger.info(log_default_params.merge(params)) + end + + def log_error(params) + logger.error(log_default_params.merge(params)) + end + + def log_default_params + { project_name: project.name, project_id: project.id } + end end end end |