use ?INFO to print log
This commit is contained in:
parent
bf0fba0811
commit
69b9e74a94
|
@ -16,6 +16,8 @@
|
|||
|
||||
-module(tcp_listener).
|
||||
|
||||
-include("emqtt.hrl").
|
||||
|
||||
-behaviour(gen_server).
|
||||
|
||||
-export([start_link/8]).
|
||||
|
@ -63,16 +65,14 @@ init({IPAddress, Port, SocketOpts,
|
|||
end,
|
||||
lists:duplicate(ConcurrentAcceptorCount, dummy)),
|
||||
{ok, {LIPAddress, LPort}} = inet:sockname(LSock),
|
||||
error_logger:info_msg(
|
||||
"started ~s on ~s:~p~n",
|
||||
?INFO("started ~s on ~s:~p~n",
|
||||
[Label, ntoab(LIPAddress), LPort]),
|
||||
apply(M, F, A ++ [IPAddress, Port]),
|
||||
{ok, #state{sock = LSock,
|
||||
on_startup = OnStartup, on_shutdown = OnShutdown,
|
||||
label = Label}};
|
||||
{error, Reason} ->
|
||||
error_logger:error_msg(
|
||||
"failed to start ~s on ~s:~p - ~p (~s)~n",
|
||||
?ERROR("failed to start ~s on ~s:~p - ~p (~s)~n",
|
||||
[Label, ntoab(IPAddress), Port,
|
||||
Reason, inet:format_error(Reason)]),
|
||||
{stop, {cannot_listen, IPAddress, Port, Reason}}
|
||||
|
@ -90,7 +90,7 @@ handle_info(_Info, State) ->
|
|||
terminate(_Reason, #state{sock=LSock, on_shutdown = {M,F,A}, label=Label}) ->
|
||||
{ok, {IPAddress, Port}} = inet:sockname(LSock),
|
||||
gen_tcp:close(LSock),
|
||||
error_logger:info_msg("stopped ~s on ~s:~p~n",
|
||||
?ERROR("stopped ~s on ~s:~p~n",
|
||||
[Label, ntoab(IPAddress), Port]),
|
||||
apply(M, F, A ++ [IPAddress, Port]).
|
||||
|
||||
|
|
Loading…
Reference in New Issue