improve(print): io:format error message without indentation
Avoid squeezing lines to the right.
This commit is contained in:
parent
65f3a2b685
commit
64cfaf4385
|
@ -55,7 +55,7 @@ start_listener({Proto, ListenOn, Opts}) ->
|
|||
io:format("Start coap:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start coap:~s listener on ~s - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start coap:~s listener on ~s: ~0p~n",
|
||||
[Proto, format(ListenOn), Reason]),
|
||||
error(Reason)
|
||||
end.
|
||||
|
@ -71,7 +71,7 @@ stop_listener({Proto, ListenOn, _Opts}) ->
|
|||
ok -> io:format("Stop coap:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to stop coap:~s listener on ~s - ~p~n.",
|
||||
io:format(standard_error, "Failed to stop coap:~s listener on ~s: ~0p~n.",
|
||||
[Proto, format(ListenOn), Reason])
|
||||
end,
|
||||
Ret.
|
||||
|
|
|
@ -69,7 +69,7 @@ start_connection_handler_instance({_Proto, _LisType, _ListenOn, Opts}) ->
|
|||
{ok, _ClientChannelPid} ->
|
||||
{_Proto, _LisType, _ListenOn, [{handler, Name} | LisOpts]};
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start ~s's connection handler - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start ~s's connection handler: ~0p~n",
|
||||
[Name, Reason]),
|
||||
error(Reason)
|
||||
end.
|
||||
|
@ -85,7 +85,7 @@ start_server({Name, Port, SSLOptions}) ->
|
|||
io:format("Start ~s gRPC server on ~w successfully.~n",
|
||||
[Name, Port]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start ~s gRPC server on ~w - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start ~s gRPC server on ~w: ~0p~n",
|
||||
[Name, Port, Reason]),
|
||||
error({failed_start_server, Reason})
|
||||
end.
|
||||
|
@ -101,7 +101,7 @@ start_listener({Proto, LisType, ListenOn, Opts}) ->
|
|||
io:format("Start ~s listener on ~s successfully.~n",
|
||||
[Name, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start ~s listener on ~s - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start ~s listener on ~s: ~0p~n",
|
||||
[Name, format(ListenOn), Reason]),
|
||||
error(Reason)
|
||||
end.
|
||||
|
@ -132,7 +132,7 @@ stop_listener({Proto, LisType, ListenOn, Opts}) ->
|
|||
io:format("Stop ~s listener on ~s successfully.~n",
|
||||
[Name, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to stop ~s listener on ~s - ~p~n.",
|
||||
io:format(standard_error, "Failed to stop ~s listener on ~s: ~0p~n",
|
||||
[Name, format(ListenOn), Reason])
|
||||
end,
|
||||
StopRet.
|
||||
|
|
|
@ -47,7 +47,7 @@ start_listener({Proto, ListenOn, Opts}) ->
|
|||
io:format("Start lwm2m:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start lwm2m:~s listener on ~s - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start lwm2m:~s listener on ~s: ~0p~n",
|
||||
[Proto, format(ListenOn), Reason]),
|
||||
error(Reason)
|
||||
end.
|
||||
|
@ -63,7 +63,7 @@ stop_listener({Proto, ListenOn, _Opts}) ->
|
|||
ok -> io:format("Stop lwm2m:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to stop lwm2m:~s listener on ~s - ~p~n.",
|
||||
io:format(standard_error, "Failed to stop lwm2m:~s listener on ~s: ~0p~n",
|
||||
[Proto, format(ListenOn), Reason])
|
||||
end,
|
||||
Ret.
|
||||
|
|
|
@ -71,7 +71,7 @@ start_listener({Proto, ListenOn, Options}) ->
|
|||
{ok, _} -> io:format("Start mqttsn:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start mqttsn:~s listener on ~s - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start mqttsn:~s listener on ~s: ~0p~n",
|
||||
[Proto, format(ListenOn), Reason]),
|
||||
error(Reason)
|
||||
end.
|
||||
|
@ -101,7 +101,7 @@ stop_listener({Proto, ListenOn, Opts}) ->
|
|||
ok -> io:format("Stop mqttsn:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to stop mqttsn:~s listener on ~s - ~p~n.",
|
||||
io:format(standard_error, "Failed to stop mqttsn:~s listener on ~s: ~0p~n",
|
||||
[Proto, format(ListenOn), Reason])
|
||||
end,
|
||||
StopRet.
|
||||
|
|
|
@ -73,7 +73,7 @@ start_listener({Proto, ListenOn, Options}) ->
|
|||
{ok, _} -> io:format("Start stomp:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start stomp:~s listener on ~s - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start stomp:~s listener on ~s: ~0p~n",
|
||||
[Proto, format(ListenOn), Reason]),
|
||||
error(Reason)
|
||||
end.
|
||||
|
@ -102,7 +102,7 @@ stop_listener({Proto, ListenOn, Opts}) ->
|
|||
ok -> io:format("Stop stomp:~s listener on ~s successfully.~n",
|
||||
[Proto, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to stop stomp:~s listener on ~s - ~p~n.",
|
||||
io:format(standard_error, "Failed to stop stomp:~s listener on ~s: ~0p~n",
|
||||
[Proto, format(ListenOn), Reason])
|
||||
end,
|
||||
StopRet.
|
||||
|
|
|
@ -47,7 +47,7 @@ main(Args) ->
|
|||
{true, pong} ->
|
||||
ok;
|
||||
{false, pong} ->
|
||||
io:format(standard_error, "Failed to connect to node ~p .\n", [TargetNode]),
|
||||
io:format(standard_error, "Failed to connect to node ~p\n", [TargetNode]),
|
||||
halt(1);
|
||||
{_, pang} ->
|
||||
io:format(standard_error, "Node ~p not responding to pings.\n", [TargetNode]),
|
||||
|
|
|
@ -157,7 +157,7 @@ cluster(["join", SNode]) ->
|
|||
ignore ->
|
||||
emqx_ctl:print("Ignore.~n");
|
||||
{error, Error} ->
|
||||
emqx_ctl:print("Failed to join the cluster: ~p~n", [Error])
|
||||
emqx_ctl:print("Failed to join the cluster: ~0p~n", [Error])
|
||||
end;
|
||||
|
||||
cluster(["leave"]) ->
|
||||
|
@ -166,7 +166,7 @@ cluster(["leave"]) ->
|
|||
emqx_ctl:print("Leave the cluster successfully.~n"),
|
||||
cluster(["status"]);
|
||||
{error, Error} ->
|
||||
emqx_ctl:print("Failed to leave the cluster: ~p~n", [Error])
|
||||
emqx_ctl:print("Failed to leave the cluster: ~0p~n", [Error])
|
||||
end;
|
||||
|
||||
cluster(["force-leave", SNode]) ->
|
||||
|
@ -177,7 +177,7 @@ cluster(["force-leave", SNode]) ->
|
|||
ignore ->
|
||||
emqx_ctl:print("Ignore.~n");
|
||||
{error, Error} ->
|
||||
emqx_ctl:print("Failed to remove the node from cluster: ~p~n", [Error])
|
||||
emqx_ctl:print("Failed to remove the node from cluster: ~0p~n", [Error])
|
||||
end;
|
||||
|
||||
cluster(["status"]) ->
|
||||
|
@ -536,7 +536,7 @@ listeners(["stop", Name = "http" ++ _N | _MaybePort]) ->
|
|||
ok ->
|
||||
emqx_ctl:print("Stop ~s listener successfully.~n", [Name]);
|
||||
{error, Error} ->
|
||||
emqx_ctl:print("Failed to stop ~s listener, error:~p~n", [Name, Error])
|
||||
emqx_ctl:print("Failed to stop ~s listener: ~0p~n", [Name, Error])
|
||||
end;
|
||||
|
||||
listeners(["stop", "mqtt:" ++ _ = Identifier]) ->
|
||||
|
@ -565,7 +565,7 @@ stop_listener(#{listen_on := ListenOn} = Listener, _Input) ->
|
|||
ok ->
|
||||
emqx_ctl:print("Stop ~s listener on ~s successfully.~n", [ID, ListenOnStr]);
|
||||
{error, Reason} ->
|
||||
emqx_ctl:print("Failed to stop ~s listener on ~s - ~p~n.",
|
||||
emqx_ctl:print("Failed to stop ~s listener on ~s: ~0p~n",
|
||||
[ID, ListenOnStr, Reason])
|
||||
end.
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ start_listener(#{proto := Proto, name := Name, listen_on := ListenOn, opts := Op
|
|||
{ok, _} -> io:format("Start ~s listener on ~s successfully.~n",
|
||||
[ID, format(ListenOn)]);
|
||||
{error, Reason} ->
|
||||
io:format(standard_error, "Failed to start mqtt listener ~s on ~s - ~0p~n!",
|
||||
io:format(standard_error, "Failed to start mqtt listener ~s on ~s: ~0p~n",
|
||||
[ID, format(ListenOn), Reason]),
|
||||
error(Reason)
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue