Commit c39a67de authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'app-logger-11' into 'master'

Use applogger in some files of auth/ldap dir

See merge request gitlab-org/gitlab!41061
parents 5d170f07 f2248300
---
title: Use applogger in some files of auth/ldap dir
merge_request: 41061
author: Rajendra Kadam
type: other
...@@ -55,7 +55,7 @@ module Gitlab ...@@ -55,7 +55,7 @@ module Gitlab
response = ldap.get_operation_result response = ldap.get_operation_result
unless response.code == 0 unless response.code == 0
Rails.logger.warn("LDAP search error: #{response.message}") # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.warn("LDAP search error: #{response.message}")
end end
[] []
...@@ -67,7 +67,7 @@ module Gitlab ...@@ -67,7 +67,7 @@ module Gitlab
retries += 1 retries += 1
error_message = connection_error_message(error) error_message = connection_error_message(error)
Rails.logger.warn(error_message) # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.warn(error_message)
if retries < MAX_SEARCH_RETRIES if retries < MAX_SEARCH_RETRIES
renew_connection_adapter renew_connection_adapter
......
...@@ -116,7 +116,7 @@ module Gitlab ...@@ -116,7 +116,7 @@ module Gitlab
true true
rescue => e rescue => e
Rails.logger.warn("Repository does not exist: #{e} at: #{disk_path}.git") # rubocop:disable Gitlab/RailsLogger Gitlab::AppLogger.warn("Repository does not exist: #{e} at: #{disk_path}.git")
Gitlab::ErrorTracking.track_exception(e, path: disk_path, storage: storage) Gitlab::ErrorTracking.track_exception(e, path: disk_path, storage: storage)
false false
......
...@@ -128,7 +128,7 @@ RSpec.describe Gitlab::Auth::Ldap::Adapter do ...@@ -128,7 +128,7 @@ RSpec.describe Gitlab::Auth::Ldap::Adapter do
before do before do
allow(adapter).to receive(:renew_connection_adapter).and_return(ldap) allow(adapter).to receive(:renew_connection_adapter).and_return(ldap)
allow(ldap).to receive(:search) { raise Net::LDAP::Error, "some error" } allow(ldap).to receive(:search) { raise Net::LDAP::Error, "some error" }
allow(Rails.logger).to receive(:warn) allow(Gitlab::AppLogger).to receive(:warn)
end end
context 'retries the operation' do context 'retries the operation' do
...@@ -152,7 +152,7 @@ RSpec.describe Gitlab::Auth::Ldap::Adapter do ...@@ -152,7 +152,7 @@ RSpec.describe Gitlab::Auth::Ldap::Adapter do
it 'logs the error' do it 'logs the error' do
expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError) expect { subject }.to raise_error(Gitlab::Auth::Ldap::LdapConnectionError)
expect(Rails.logger).to have_received(:warn).with( expect(Gitlab::AppLogger).to have_received(:warn).with(
"LDAP search raised exception Net::LDAP::Error: some error") "LDAP search raised exception Net::LDAP::Error: some error")
end end
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