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

This MR adds AppLogger

This MR adds AppLogger in auth/ldap files
and adds changelog for
the changes

Change type in changelog
parent e550811c
---
title: Use applogger in some files of auth/ldap dir
merge_request: 41061
author: Rajendra Kadam
type: other
......@@ -55,7 +55,7 @@ module Gitlab
response = ldap.get_operation_result
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
[]
......@@ -67,7 +67,7 @@ module Gitlab
retries += 1
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
renew_connection_adapter
......
......@@ -116,7 +116,7 @@ module Gitlab
true
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)
false
......
......@@ -128,7 +128,7 @@ RSpec.describe Gitlab::Auth::Ldap::Adapter do
before do
allow(adapter).to receive(:renew_connection_adapter).and_return(ldap)
allow(ldap).to receive(:search) { raise Net::LDAP::Error, "some error" }
allow(Rails.logger).to receive(:warn)
allow(Gitlab::AppLogger).to receive(:warn)
end
context 'retries the operation' do
......@@ -152,7 +152,7 @@ RSpec.describe Gitlab::Auth::Ldap::Adapter do
it 'logs the error' do
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")
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