Merge pull request #9244 from HJianBo/using-warning-level

chore(auth-http): using warning level instead of error
This commit is contained in:
Zaiming (Stone) Shi 2022-10-27 20:42:00 +02:00 committed by GitHub
commit 307ff6b97b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 11 deletions

View File

@ -46,11 +46,11 @@ check_acl(ClientInfo, PubSub, Topic, _AclResult, #{acl := ACLParams = #{path :=
{ok, 200, <<"ignore">>} -> ok; {ok, 200, <<"ignore">>} -> ok;
{ok, 200, _Body} -> {stop, allow}; {ok, 200, _Body} -> {stop, allow};
{ok, Code, _Body} -> {ok, Code, _Body} ->
?LOG(error, "Deny ~s to topic ~ts, username: ~ts, http response code: ~p", ?LOG(warning, "Deny ~s to topic ~ts, username: ~ts, http response code: ~p",
[PubSub, Topic, Username, Code]), [PubSub, Topic, Username, Code]),
{stop, deny}; {stop, deny};
{error, Error} -> {error, Error} ->
?LOG(error, "Deny ~s to topic ~ts, username: ~ts, due to request " ?LOG(warning, "Deny ~s to topic ~ts, username: ~ts, due to request "
"http server failure, path: ~p, error: ~0p", "http server failure, path: ~p, error: ~0p",
[PubSub, Topic, Username, Path, Error]), [PubSub, Topic, Username, Path, Error]),
ok ok

View File

@ -47,13 +47,13 @@ check(ClientInfo, AuthResult, #{auth := AuthParms = #{path := Path},
anonymous => false, anonymous => false,
mountpoint => mountpoint(Body, ClientInfo)}}; mountpoint => mountpoint(Body, ClientInfo)}};
{ok, Code, _Body} -> {ok, Code, _Body} ->
?LOG(error, "Deny connection from path: ~s, username: ~ts, http " ?LOG(warning, "Deny connection from path: ~s, username: ~ts, http "
"response code: ~p", "response code: ~p",
[Path, Username, Code]), [Path, Username, Code]),
{stop, AuthResult#{auth_result => http_to_connack_error(Code), {stop, AuthResult#{auth_result => http_to_connack_error(Code),
anonymous => false}}; anonymous => false}};
{error, Error} -> {error, Error} ->
?LOG(error, "Deny connection from path: ~s, username: ~ts, due to " ?LOG(warning, "Deny connection from path: ~s, username: ~ts, due to "
"request http-server failed: ~0p", "request http-server failed: ~0p",
[Path, Username, Error]), [Path, Username, Error]),
%%FIXME later: server_unavailable is not right. %%FIXME later: server_unavailable is not right.
@ -91,7 +91,7 @@ is_superuser(SuperParams =
case request(PoolName, Method, Path, Headers, feedvar(Params, ClientInfo), Timeout, Retry) of case request(PoolName, Method, Path, Headers, feedvar(Params, ClientInfo), Timeout, Retry) of
{ok, 200, _Body} -> true; {ok, 200, _Body} -> true;
{ok, _Code, _Body} -> false; {ok, _Code, _Body} -> false;
{error, Error} -> ?LOG(error, "Request superuser path ~s, error: ~p", [Path, Error]), {error, Error} -> ?LOG(warning, "Request superuser path ~s, error: ~p", [Path, Error]),
false false
end. end.