fix(mod_subscription): improve the log information
This commit is contained in:
parent
4fe9275103
commit
c43f179204
|
@ -47,10 +47,14 @@ on_client_connected(#{clientid := ClientId, username := Username}, _ConnInfo = #
|
||||||
|
|
||||||
Fold = fun({Topic, SubOpts}, Acc) ->
|
Fold = fun({Topic, SubOpts}, Acc) ->
|
||||||
case rep(Topic, ClientId, Username) of
|
case rep(Topic, ClientId, Username) of
|
||||||
{error, _} ->
|
{error, Reason} ->
|
||||||
|
?LOG(warning, "auto subscribe ignored, topic filter:~ts reason:~p~n",
|
||||||
|
[Topic, Reason]),
|
||||||
Acc;
|
Acc;
|
||||||
<<>> ->
|
<<>> ->
|
||||||
?LOG(warning, "Topic can't be empty when auto subscribe"),
|
?LOG(warning, "auto subscribe ignored, topic filter:~ts"
|
||||||
|
" reason: topic can't be empty~n",
|
||||||
|
[Topic]),
|
||||||
Acc;
|
Acc;
|
||||||
NewTopic ->
|
NewTopic ->
|
||||||
[{NewTopic, OptFun(SubOpts)} | Acc]
|
[{NewTopic, OptFun(SubOpts)} | Acc]
|
||||||
|
@ -82,7 +86,6 @@ rep([<<"%c">> | T], ClientId, Username, Acc) ->
|
||||||
Username,
|
Username,
|
||||||
[ClientId | Acc]);
|
[ClientId | Acc]);
|
||||||
rep([<<"%u">> | _], _, undefined, _) ->
|
rep([<<"%u">> | _], _, undefined, _) ->
|
||||||
?LOG(error, "Username undefined when auto subscribe"),
|
|
||||||
{error, username_undefined};
|
{error, username_undefined};
|
||||||
rep([<<"%u">> | T], ClientId, Username, Acc) ->
|
rep([<<"%u">> | T], ClientId, Username, Acc) ->
|
||||||
rep(T,
|
rep(T,
|
||||||
|
|
Loading…
Reference in New Issue