Commit ab0a7ea9 authored by Rajendra Kadam's avatar Rajendra Kadam Committed by Peter Leitzen

Use appLogger in project.rb

parent 9ed1e151
......@@ -925,17 +925,15 @@ class Project < ApplicationRecord
job_id
end
# rubocop:disable Gitlab/RailsLogger
def log_import_activity(job_id, type: :import)
job_type = type.to_s.capitalize
if job_id
Rails.logger.info("#{job_type} job scheduled for #{full_path} with job ID #{job_id}.")
Gitlab::AppLogger.info("#{job_type} job scheduled for #{full_path} with job ID #{job_id}.")
else
Rails.logger.error("#{job_type} job failed to create for #{full_path}.")
Gitlab::AppLogger.error("#{job_type} job failed to create for #{full_path}.")
end
end
# rubocop:enable Gitlab/RailsLogger
def reset_cache_and_import_attrs
run_after_commit do
......@@ -1776,17 +1774,15 @@ class Project < ApplicationRecord
ensure_pages_metadatum.update!(deployed: false)
end
# rubocop:disable Gitlab/RailsLogger
def write_repository_config(gl_full_path: full_path)
# We'd need to keep track of project full path otherwise directory tree
# created with hashed storage enabled cannot be usefully imported using
# the import rake task.
repository.raw_repository.write_config(full_path: gl_full_path)
rescue Gitlab::Git::Repository::NoRepository => e
Rails.logger.error("Error writing to .git/config for project #{full_path} (#{id}): #{e.message}.")
Gitlab::AppLogger.error("Error writing to .git/config for project #{full_path} (#{id}): #{e.message}.")
nil
end
# rubocop:enable Gitlab/RailsLogger
def after_import
repository.expire_content_cache
......@@ -1829,17 +1825,15 @@ class Project < ApplicationRecord
@pipeline_status ||= Gitlab::Cache::Ci::ProjectPipelineStatus.load_for_project(self)
end
# rubocop:disable Gitlab/RailsLogger
def add_export_job(current_user:, after_export_strategy: nil, params: {})
job_id = ProjectExportWorker.perform_async(current_user.id, self.id, after_export_strategy, params)
if job_id
Rails.logger.info "Export job started for project ID #{self.id} with job ID #{job_id}"
Gitlab::AppLogger.info "Export job started for project ID #{self.id} with job ID #{job_id}"
else
Rails.logger.error "Export job failed to start for project ID #{self.id}"
Gitlab::AppLogger.error "Export job failed to start for project ID #{self.id}"
end
end
# rubocop:enable Gitlab/RailsLogger
def import_export_shared
@import_export_shared ||= Gitlab::ImportExport::Shared.new(self)
......
---
title: Use applogger in project.rb
merge_request: 32183
author: Rajendra Kadam
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment