Skip to content

Commit ff05a90

Browse files
committed
Local shovels: remove rabbit_log and switch to LOG_ macros
1 parent a68b825 commit ff05a90

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

deps/rabbitmq_shovel/src/rabbit_local_shovel.erl

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
-include_lib("amqp_client/include/amqp_client.hrl").
1313
-include_lib("amqp10_common/include/amqp10_types.hrl").
14+
-include_lib("kernel/include/logger.hrl").
1415
-include_lib("rabbit/include/mc.hrl").
1516
-include("rabbit_shovel.hrl").
1617

@@ -188,12 +189,12 @@ init_source(State = #{source := #{queue := QName0,
188189
{0, {error, autodelete}} ->
189190
exit({shutdown, autodelete});
190191
{_Remaining, {error, Reason}} ->
191-
rabbit_log:error(
192-
"Shovel '~ts' in vhost '~ts' failed to consume: ~ts",
193-
[Name, VHost, Reason]),
192+
?LOG_ERROR(
193+
"Shovel '~ts' in vhost '~ts' failed to consume: ~ts",
194+
[Name, VHost, Reason]),
194195
exit({shutdown, failed_to_consume_from_source});
195196
{unlimited, {error, not_implemented, Reason, ReasonArgs}} ->
196-
rabbit_log:error(
197+
?LOG_ERROR(
197198
"Shovel '~ts' in vhost '~ts' failed to consume: ~ts",
198199
[Name, VHost, io_lib:format(Reason, ReasonArgs)]),
199200
exit({shutdown, failed_to_consume_from_source});
@@ -267,8 +268,8 @@ close_source(#{source := #{current := #{queue_states := QStates0,
267268
{error, not_found} ->
268269
ok;
269270
{error, Reason} ->
270-
rabbit_log:warning("Local shovel failed to remove consumer ~tp: ~tp",
271-
[CTag, Reason]),
271+
?LOG_WARNING("Local shovel failed to remove consumer ~tp: ~tp",
272+
[CTag, Reason]),
272273
ok
273274
end;
274275
close_source(_) ->
@@ -421,8 +422,7 @@ handle_queue_actions(Actions, State) ->
421422
handle_deliver(AckRequired, Msgs, S0);
422423
({credit_reply, _, _, _, _, _} = Action, S0) ->
423424
handle_credit_reply(Action, S0);
424-
(Action, S0) ->
425-
rabbit_log:warning("ACTION NOT HANDLED ~p", [Action]),
425+
(_Action, S0) ->
426426
S0
427427
%% ({queue_down, QRef}, S0) ->
428428
%% State;
@@ -558,7 +558,7 @@ get_user_vhost_from_amqp_param(Uri) ->
558558
exit({shutdown, {access_refused, Username}})
559559
end;
560560
{refused, Username, _Msg, _Module} ->
561-
rabbit_log:error("Local shovel user ~ts was refused access"),
561+
?LOG_ERROR("Local shovel user ~ts was refused access"),
562562
exit({shutdown, {access_refused, Username}})
563563
end.
564564

@@ -576,8 +576,8 @@ settle(Op, DeliveryTag, Multiple, #{unacked_message_q := UAMQ0,
576576
unacked_message_q => UAMQ},
577577
handle_queue_actions(Actions, State);
578578
{'protocol_error', Type, Reason, Args} ->
579-
rabbit_log:error("Shovel failed to settle ~p acknowledgments with ~tp: ~tp",
580-
[Op, Type, io_lib:format(Reason, Args)]),
579+
?LOG_ERROR("Shovel failed to settle ~p acknowledgments with ~tp: ~tp",
580+
[Op, Type, io_lib:format(Reason, Args)]),
581581
exit({shutdown, {ack_failed, Reason}})
582582
end.
583583

0 commit comments

Comments
 (0)