1111
1212-include_lib (" eldap/include/eldap.hrl" ).
1313-include_lib (" rabbit_common/include/rabbit.hrl" ).
14+ -include_lib (" kernel/include/logger.hrl" ).
15+ -include (" logging.hrl" ).
1416
1517-behaviour (rabbit_authn_backend ).
1618-behaviour (rabbit_authz_backend ).
@@ -514,18 +516,16 @@ with_ldap({ok, Creds}, Fun, Servers) ->
514516 Opts1 = case env (log ) of
515517 network ->
516518 Pre = " LDAP network traffic: " ,
517- rabbit_log_ldap :info (
518- " LDAP connecting to servers: ~tp " , [Servers ]),
519- [{log , fun (1 , S , A ) -> rabbit_log_ldap :warning (Pre ++ S , A );
519+ ? LOG_INFO (" LDAP connecting to servers: ~tp " , [Servers ]),
520+ [{log , fun (1 , S , A ) -> ? LOG_WARNING (Pre ++ S , A );
520521 (2 , S , A ) ->
521- rabbit_log_ldap : info (Pre ++ S , scrub_creds (A , []))
522+ ? LOG_INFO (Pre ++ S , scrub_creds (A , []))
522523 end } | Opts0 ];
523524 network_unsafe ->
524525 Pre = " LDAP network traffic: " ,
525- rabbit_log_ldap :info (
526- " LDAP connecting to servers: ~tp " , [Servers ]),
527- [{log , fun (1 , S , A ) -> rabbit_log_ldap :warning (Pre ++ S , A );
528- (2 , S , A ) -> rabbit_log_ldap :info ( Pre ++ S , A )
526+ ? LOG_INFO (" LDAP connecting to servers: ~tp " , [Servers ]),
527+ [{log , fun (1 , S , A ) -> ? LOG_WARNING (Pre ++ S , A );
528+ (2 , S , A ) -> ? LOG_INFO ( Pre ++ S , A )
529529 end } | Opts0 ];
530530 _ ->
531531 Opts0
@@ -550,7 +550,7 @@ with_ldap({ok, Creds}, Fun, Servers) ->
550550with_login (Creds , Servers , Opts , Fun ) ->
551551 with_login (Creds , Servers , Opts , Fun , ? LDAP_OPERATION_RETRIES ).
552552with_login (_Creds , _Servers , _Opts , _Fun , 0 = _RetriesLeft ) ->
553- rabbit_log_ldap : warning (" LDAP failed to perform an operation. TCP connection to a LDAP server was closed or otherwise defunct. Exhausted all retries." ),
553+ ? LOG_WARNING (" LDAP failed to perform an operation. TCP connection to a LDAP server was closed or otherwise defunct. Exhausted all retries." ),
554554 {error , ldap_connect_error };
555555with_login (Creds , Servers , Opts , Fun , RetriesLeft ) ->
556556 case get_or_create_conn (Creds == anon , Servers , Opts ) of
@@ -609,9 +609,9 @@ with_login(Creds, Servers, Opts, Fun, RetriesLeft) ->
609609
610610purge_connection (Creds , Servers , Opts ) ->
611611 % % purge and retry with a new connection
612- rabbit_log_ldap : warning (" TCP connection to a LDAP server was closed or otherwise defunct." ),
612+ ? LOG_WARNING (" TCP connection to a LDAP server was closed or otherwise defunct." ),
613613 purge_conn (Creds == anon , Servers , Opts ),
614- rabbit_log_ldap : warning (" LDAP will retry with a new connection." ).
614+ ? LOG_WARNING (" LDAP will retry with a new connection." ).
615615
616616call_ldap_fun (Fun , LDAP ) ->
617617 call_ldap_fun (Fun , LDAP , " " ).
@@ -725,7 +725,7 @@ purge_conn(IsAnon, Servers, Opts) ->
725725 Conns = get (ldap_conns ),
726726 Key = {IsAnon , Servers , Opts },
727727 {ok , Conn } = maps :find (Key , Conns ),
728- rabbit_log_ldap : warning (" LDAP will purge an already closed or defunct LDAP server connection from the pool" ),
728+ ? LOG_WARNING (" LDAP will purge an already closed or defunct LDAP server connection from the pool" ),
729729 % We cannot close the connection with eldap:close/1 because as of OTP-13327
730730 % eldap will try to do_unbind first and will fail with a `{gen_tcp_error, closed}`.
731731 % Since we know that the connection is already closed, we just
@@ -770,7 +770,7 @@ ssl_options() ->
770770 Opts0 = rabbit_ssl_options :fix_client (env (ssl_options )),
771771 case env (ssl_hostname_verification , undefined ) of
772772 wildcard ->
773- rabbit_log_ldap : debug (" Enabling wildcard-aware hostname verification for LDAP client connections" ),
773+ ? LOG_DEBUG (" Enabling wildcard-aware hostname verification for LDAP client connections" ),
774774 % % Needed for non-HTTPS connections that connect to servers that use wildcard certificates.
775775 % % See https://erlang.org/doc/man/public_key.html#pkix_verify_hostname_match_fun-1.
776776 [{customize_hostname_check , [{match_fun , public_key :pkix_verify_hostname_match_fun (https )}]} | Opts0 ];
@@ -786,7 +786,7 @@ at_least(Ver) ->
786786get_expected_env_str (Key , Default ) ->
787787 V = case env (Key ) of
788788 Default ->
789- rabbit_log_ldap : warning (" rabbitmq_auth_backend_ldap configuration key '~tp ' is set to "
789+ ? LOG_WARNING (" rabbitmq_auth_backend_ldap configuration key '~tp ' is set to "
790790 " the default value of '~tp ', expected to get a non-default value" ,
791791 [Key , Default ]),
792792 Default ;
@@ -884,7 +884,7 @@ dn_lookup(Username, LDAP) ->
884884 ? L1 (" DN lookup: ~ts -> ~ts " , [Username , DN ]),
885885 DN ;
886886 {ok , {eldap_search_result , Entries , _Referrals , _Controls }} ->
887- rabbit_log_ldap : warning (" Searching for DN for ~ts , got back ~tp " ,
887+ ? LOG_WARNING (" Searching for DN for ~ts , got back ~tp " ,
888888 [Filled , Entries ]),
889889 Filled ;
890890 {error , _ } = E ->
@@ -963,7 +963,7 @@ is_dn(_S) -> false.
963963
964964log (Fmt , Args ) -> case env (log ) of
965965 false -> ok ;
966- _ -> rabbit_log_ldap : info (Fmt ++ " " , Args )
966+ _ -> ? LOG_INFO (Fmt ++ " " , Args )
967967 end .
968968
969969fill (Fmt , Args ) ->
0 commit comments