refactor(emqx): fix remaining legacy logging
This commit is contained in:
parent
40963221f8
commit
eb43423552
|
@ -66,6 +66,8 @@
|
|||
, find_listener_conf/3
|
||||
]).
|
||||
|
||||
-include("logger.hrl").
|
||||
|
||||
-define(CONF, conf).
|
||||
-define(RAW_CONF, raw_conf).
|
||||
-define(PERSIS_SCHEMA_MODS, {?MODULE, schema_mods}).
|
||||
|
@ -250,7 +252,7 @@ init_load(SchemaMod, Conf) when is_list(Conf) orelse is_binary(Conf) ->
|
|||
{ok, RawRichConf} ->
|
||||
init_load(SchemaMod, RawRichConf);
|
||||
{error, Reason} ->
|
||||
logger:error(#{msg => failed_to_load_hocon_conf,
|
||||
?SLOG(error, #{msg => failed_to_load_hocon_conf,
|
||||
reason => Reason
|
||||
}),
|
||||
error(failed_to_load_hocon_conf)
|
||||
|
@ -359,7 +361,9 @@ save_to_override_conf(RawConf) ->
|
|||
case file:write_file(FileName, hocon_pp:do(RawConf, #{})) of
|
||||
ok -> ok;
|
||||
{error, Reason} ->
|
||||
logger:error("write to ~s failed, ~p", [FileName, Reason]),
|
||||
?SLOG(error, #{msg => failed_to_write_override_file,
|
||||
filename => FileName,
|
||||
reason => Reason}),
|
||||
{error, Reason}
|
||||
end
|
||||
end.
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
, check_pass/2
|
||||
]).
|
||||
|
||||
-include("logger.hrl").
|
||||
|
||||
-type(hash_type() :: plain | md5 | sha | sha256 | pbkdf2 | bcrypt).
|
||||
|
||||
-export_type([hash_type/0]).
|
||||
|
@ -67,8 +69,8 @@ hash(pbkdf2, {Salt, Password, Macfun, Iterations, Dklen}) ->
|
|||
case pbkdf2:pbkdf2(Macfun, Password, Salt, Iterations, Dklen) of
|
||||
{ok, Hexstring} ->
|
||||
pbkdf2:to_hex(Hexstring);
|
||||
{error, Error} ->
|
||||
error_logger:error_msg("pbkdf2 hash error:~p", [Error]),
|
||||
{error, Reason} ->
|
||||
?SLOG(error, #{msg => "pbkdf2_hash_error", reason => Reason}),
|
||||
<<>>
|
||||
end;
|
||||
hash(bcrypt, {Salt, Password}) ->
|
||||
|
@ -76,8 +78,8 @@ hash(bcrypt, {Salt, Password}) ->
|
|||
case bcrypt:hashpw(Password, Salt) of
|
||||
{ok, HashPasswd} ->
|
||||
list_to_binary(HashPasswd);
|
||||
{error, Error}->
|
||||
error_logger:error_msg("bcrypt hash error:~p", [Error]),
|
||||
{error, Reason}->
|
||||
?SLOG(error, #{msg => "bcrypt_hash_error", reason => Reason}),
|
||||
<<>>
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue