Commit 2f416018 authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'rails-logger-cop-4' into 'master'

Use appLogger in repository model

See merge request gitlab-org/gitlab!32185
parents a0265d4f cac68196
...@@ -950,7 +950,6 @@ class Repository ...@@ -950,7 +950,6 @@ class Repository
async_remove_remote(remote_name) if tmp_remote_name async_remove_remote(remote_name) if tmp_remote_name
end end
# rubocop:disable Gitlab/RailsLogger
def async_remove_remote(remote_name) def async_remove_remote(remote_name)
return unless remote_name return unless remote_name
return unless project return unless project
...@@ -958,14 +957,13 @@ class Repository ...@@ -958,14 +957,13 @@ class Repository
job_id = RepositoryRemoveRemoteWorker.perform_async(project.id, remote_name) job_id = RepositoryRemoveRemoteWorker.perform_async(project.id, remote_name)
if job_id if job_id
Rails.logger.info("Remove remote job scheduled for #{project.id} with remote name: #{remote_name} job ID #{job_id}.") Gitlab::AppLogger.info("Remove remote job scheduled for #{project.id} with remote name: #{remote_name} job ID #{job_id}.")
else else
Rails.logger.info("Remove remote job failed to create for #{project.id} with remote name #{remote_name}.") Gitlab::AppLogger.info("Remove remote job failed to create for #{project.id} with remote name #{remote_name}.")
end end
job_id job_id
end end
# rubocop:enable Gitlab/RailsLogger
def fetch_source_branch!(source_repository, source_branch, local_ref) def fetch_source_branch!(source_repository, source_branch, local_ref)
raw_repository.fetch_source_branch!(source_repository.raw_repository, source_branch, local_ref) raw_repository.fetch_source_branch!(source_repository.raw_repository, source_branch, local_ref)
......
---
title: Use applogger in repository model
merge_request: 32185
author: Rajendra Kadam
type: fixed
...@@ -974,7 +974,7 @@ describe Repository do ...@@ -974,7 +974,7 @@ describe Repository do
end end
it 'returns nil' do it 'returns nil' do
expect(Rails.logger).to receive(:info).with("Remove remote job failed to create for #{project.id} with remote name joe.") expect(Gitlab::AppLogger).to receive(:info).with("Remove remote job failed to create for #{project.id} with remote name joe.")
expect(repository.async_remove_remote('joe')).to be_nil expect(repository.async_remove_remote('joe')).to be_nil
end end
......
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