Commit b8e67cb6 authored by Peter Leitzen's avatar Peter Leitzen

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

Use applogger in ee/gitlab/auth/ldap/sync

See merge request gitlab-org/gitlab!41051
parents 9e130f19 90ba61fa
---
title: Use applogger in some files of lib/gitlab/ldap/sync/*
merge_request: 41051
author: Rajendra Kadam
type: other
......@@ -45,7 +45,7 @@ module EE
def ldap_group_member_dns(ldap_group_cn)
ldap_group = Ldap::Group.find_by_cn(ldap_group_cn, adapter)
unless ldap_group.present?
logger.warn { "Cannot find LDAP group with CN '#{ldap_group_cn}'. Skipping" }
logger.warn "Cannot find LDAP group with CN '#{ldap_group_cn}'. Skipping"
return []
end
......@@ -64,7 +64,7 @@ module EE
ensure_full_dns!(member_dns)
logger.debug { "Members in '#{ldap_group.name}' LDAP group: #{member_dns}" }
logger.debug "Members in '#{ldap_group.name}' LDAP group: #{member_dns}"
# Various lookups in this method could return `nil` values.
# Compact the array to remove those entries
......@@ -80,7 +80,7 @@ module EE
dn_obj = ::Gitlab::Auth::Ldap::DN.new(dn)
parsed_dn = dn_obj.to_a
rescue ::Gitlab::Auth::Ldap::DN::FormatError => e
logger.error { "Found malformed DN: '#{dn}'. Skipping. Error: \"#{e.message}\"" }
logger.error "Found malformed DN: '#{dn}'. Skipping. Error: \"#{e.message}\""
next
end
......@@ -90,12 +90,12 @@ module EE
if parsed_dn.count > 2
dn_obj.to_normalized_s
elsif parsed_dn.count == 0
logger.warn { "Found null DN. Skipping." }
logger.warn "Found null DN. Skipping."
nil
elsif parsed_dn[0] == 'uid'
dn_for_uid(parsed_dn[1])
else
logger.warn { "Found potentially malformed/incomplete DN: '#{dn}'" }
logger.warn "Found potentially malformed/incomplete DN: '#{dn}'"
dn
end
......@@ -150,19 +150,19 @@ module EE
# rubocop: enable CodeReuse/ActiveRecord
def dn_filter_search(filter)
logger.debug { "Running filter \"#{filter}\" against #{provider}" }
logger.debug "Running filter \"#{filter}\" against #{provider}"
dns = adapter.filter_search(filter).map(&:dn)
ensure_full_dns!(dns)
logger.debug { "Found #{dns.count} matching users for filter #{filter}" }
logger.debug "Found #{dns.count} matching users for filter #{filter}"
dns
end
def logger
Rails.logger # rubocop:disable Gitlab/RailsLogger
::Gitlab::AppLogger
end
end
end
......
......@@ -41,7 +41,7 @@ module Gitlab
available = max_capacity - current_capacity
if available < 0
Rails.logger.info("Mirror available capacity is below 0: #{available}") # rubocop:disable Gitlab/RailsLogger
Gitlab::AppLogger.info("Mirror available capacity is below 0: #{available}")
available = 0
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