Skip to content

Commit 231bf48

Browse files
committed
[skip ci] Remove rabbit_log_connection and use LOG_ macros
1 parent 2d0d3af commit 231bf48

File tree

9 files changed

+113
-217
lines changed

9 files changed

+113
-217
lines changed

deps/rabbit/src/rabbit_connection_tracking.erl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,11 @@ handle_cast({connection_created, Details}) ->
7878
error:{no_exists, _} ->
7979
Msg = "Could not register connection ~tp for tracking, "
8080
"its table is not ready yet or the connection terminated prematurely",
81-
rabbit_log_connection:warning(Msg, [ConnId]),
81+
?LOG_WARNING(Msg, [ConnId]),
8282
ok;
8383
error:Err ->
8484
Msg = "Could not register connection ~tp for tracking: ~tp",
85-
rabbit_log_connection:warning(Msg, [ConnId, Err]),
85+
?LOG_WARNING(Msg, [ConnId, Err]),
8686
ok
8787
end;
8888
_OtherNode ->
@@ -107,7 +107,7 @@ handle_cast({vhost_deleted, Details}) ->
107107
%% Schedule vhost entry deletion, allowing time for connections to close
108108
_ = timer:apply_after(?TRACKING_EXECUTION_TIMEOUT, ?MODULE,
109109
delete_tracked_connection_vhost_entry, [VHost]),
110-
rabbit_log_connection:info("Closing all connections in vhost '~ts' because it's being deleted", [VHost]),
110+
?LOG_INFO("Closing all connections in vhost '~ts' because it's being deleted", [VHost]),
111111
shutdown_tracked_items(
112112
list(VHost),
113113
rabbit_misc:format("vhost '~ts' is deleted", [VHost]));
@@ -117,7 +117,7 @@ handle_cast({vhost_deleted, Details}) ->
117117
handle_cast({vhost_down, Details}) ->
118118
VHost = pget(name, Details),
119119
Node = pget(node, Details),
120-
rabbit_log_connection:info("Closing all connections in vhost '~ts' on node '~ts'"
120+
?LOG_INFO("Closing all connections in vhost '~ts' on node '~ts'"
121121
" because the vhost is stopping",
122122
[VHost, Node]),
123123
shutdown_tracked_items(
@@ -128,7 +128,7 @@ handle_cast({user_deleted, Details}) ->
128128
%% Schedule user entry deletion, allowing time for connections to close
129129
_ = timer:apply_after(?TRACKING_EXECUTION_TIMEOUT, ?MODULE,
130130
delete_tracked_connection_user_entry, [Username]),
131-
rabbit_log_connection:info("Closing all connections for user '~ts' because the user is being deleted", [Username]),
131+
?LOG_INFO("Closing all connections for user '~ts' because the user is being deleted", [Username]),
132132
shutdown_tracked_items(
133133
list_of_user(Username),
134134
rabbit_misc:format("user '~ts' is deleted", [Username])).

deps/rabbit/src/rabbit_connection_tracking_handler.erl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
-export([close_connections/3]).
2323

2424
-include_lib("rabbit_common/include/rabbit.hrl").
25+
-include_lib("rabbit_common/include/logging.hrl").
2526

2627
-rabbit_boot_step({?MODULE,
2728
[{description, "connection tracking event handler"},
@@ -37,6 +38,7 @@
3738
%%
3839

3940
init([]) ->
41+
logger:set_process_metadata(#{domain => ?RMQLOG_DOMAIN_CONN}),
4042
{ok, []}.
4143

4244
handle_event(#event{type = connection_created, props = Details}, State) ->

deps/rabbit/src/rabbit_direct.erl

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
-include_lib("rabbit_common/include/rabbit.hrl").
2222
-include_lib("rabbit_common/include/rabbit_misc.hrl").
23+
-include_lib("kernel/include/logger.hrl").
2324

2425
%%----------------------------------------------------------------------------
2526

@@ -157,7 +158,7 @@ is_vhost_alive(VHost, {Username, _Password}, Pid) ->
157158
case rabbit_vhost_sup_sup:is_vhost_alive(VHost) of
158159
true -> true;
159160
false ->
160-
rabbit_log_connection:error(
161+
?LOG_ERROR(
161162
"Error on direct client connection ~tp~n"
162163
"access to vhost '~ts' refused for user '~ts': "
163164
"vhost '~ts' is down",
@@ -173,15 +174,15 @@ is_over_vhost_connection_limit(VHost, {Username, _Password}, Pid) ->
173174
try rabbit_vhost_limit:is_over_connection_limit(VHost) of
174175
false -> false;
175176
{true, Limit} ->
176-
rabbit_log_connection:error(
177+
?LOG_ERROR(
177178
"Error on direct client connection ~tp~n"
178179
"access to vhost '~ts' refused for user '~ts': "
179180
"vhost connection limit (~tp) is reached",
180181
[Pid, VHost, PrintedUsername, Limit]),
181182
true
182183
catch
183184
throw:{error, {no_such_vhost, VHost}} ->
184-
rabbit_log_connection:error(
185+
?LOG_ERROR(
185186
"Error on direct client connection ~tp~n"
186187
"vhost ~ts not found", [Pid, VHost]),
187188
true
@@ -211,7 +212,7 @@ connect1(User = #user{username = Username}, VHost, Protocol, Pid, Infos) ->
211212
{error, Reason}
212213
end;
213214
{true, Limit} ->
214-
rabbit_log_connection:error(
215+
?LOG_ERROR(
215216
"Error on Direct connection ~tp~n"
216217
"access refused for user '~ts': "
217218
"user connection limit (~tp) is reached",
@@ -237,7 +238,7 @@ start_channel(Number, ClientChannelPid, ConnPid, ConnName, Protocol,
237238
User, VHost, Capabilities, Collector, AmqpParams}]),
238239
{ok, ChannelPid};
239240
{true, Limit} ->
240-
rabbit_log_connection:error(
241+
?LOG_ERROR(
241242
"Error on direct connection ~tp~n"
242243
"number of channels opened for user '~ts' has reached the "
243244
"maximum allowed limit of (~w)",

deps/rabbit/src/rabbit_log_connection.erl

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)