diff options
author | Evgeny Khramtsov <ekhramtsov@process-one.net> | 2019-09-23 15:17:20 +0300 |
---|---|---|
committer | Evgeny Khramtsov <ekhramtsov@process-one.net> | 2019-09-23 15:17:20 +0300 |
commit | 5770946f03ba669ea867b787fbd546333a8a3814 (patch) | |
tree | 73a03717ac5d4c31e12b92c1aba3b407f3c5329c /src/ejabberd_piefxis.erl | |
parent | Fix unicode formatting in ACME module (diff) |
Correctly handle unicode in log messages
Diffstat (limited to 'src/ejabberd_piefxis.erl')
-rw-r--r-- | src/ejabberd_piefxis.erl | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/ejabberd_piefxis.erl b/src/ejabberd_piefxis.erl index 2b93b4f19..0722e137e 100644 --- a/src/ejabberd_piefxis.erl +++ b/src/ejabberd_piefxis.erl @@ -86,7 +86,7 @@ import_file(FileName, State) -> Res; {error, Reason} -> ErrTxt = file:format_error(Reason), - ?ERROR_MSG("Failed to open file '~s': ~s", [FileName, ErrTxt]), + ?ERROR_MSG("Failed to open file '~ts': ~ts", [FileName, ErrTxt]), {error, Reason} end. @@ -125,7 +125,7 @@ export_hosts(Hosts, Dir) -> end, ok, FilesAndHosts); {error, Reason} -> ErrTxt = file:format_error(Reason), - ?ERROR_MSG("Failed to open file '~s': ~s", [DFn, ErrTxt]), + ?ERROR_MSG("Failed to open file '~ts': ~ts", [DFn, ErrTxt]), {error, Reason} end. @@ -149,7 +149,7 @@ export_host(Dir, FnH, Host) -> end; {error, Reason} -> ErrTxt = file:format_error(Reason), - ?ERROR_MSG("Failed to open file '~s': ~s", [DFn, ErrTxt]), + ?ERROR_MSG("Failed to open file '~ts': ~ts", [DFn, ErrTxt]), {error, Reason} end. @@ -315,7 +315,7 @@ process_el({xmlstreamstart, <<"server-data">>, Attrs}, State) -> ?NS_PIE -> {ok, State}; NS -> - stop("Unknown 'server-data' namespace = ~s", [NS]) + stop("Unknown 'server-data' namespace = ~ts", [NS]) end; process_el({xmlstreamend, _}, State) -> {ok, State}; @@ -344,10 +344,10 @@ process_el({xmlstreamelement, #xmlel{name = <<"host">>, true -> process_users(Els, State#state{server = S}); false -> - stop("Unknown host: ~s", [S]) + stop("Unknown host: ~ts", [S]) end catch _:{bad_jid, _} -> - stop("Invalid 'jid': ~s", [JIDS]) + stop("Invalid 'jid': ~ts", [JIDS]) end; process_el({xmlstreamstart, <<"user">>, Attrs}, State = #state{server = S}) when S /= <<"">> -> @@ -395,7 +395,7 @@ process_user(#xmlel{name = <<"user">>, attrs = Attrs, children = Els}, case jid:nodeprep(Name) of error -> - stop("Invalid 'user': ~s", [Name]); + stop("Invalid 'user': ~ts", [Name]); LUser -> case ejabberd_auth:try_register(LUser, LServer, Pass) of ok -> @@ -403,7 +403,7 @@ process_user(#xmlel{name = <<"user">>, attrs = Attrs, children = Els}, {error, invalid_password} when (Password == <<>>) -> process_user_els(Els, State#state{user = LUser}); {error, Err} -> - stop("Failed to create user '~s': ~p", [Name, Err]) + stop("Failed to create user '~ts': ~p", [Name, Err]) end end. @@ -442,7 +442,7 @@ process_user_el(#xmlel{name = Name, attrs = Attrs, children = Els} = El, end catch _:{xmpp_codec, Why} -> ErrTxt = xmpp:format_error(Why), - stop("failed to decode XML '~s': ~s", + stop("failed to decode XML '~ts': ~ts", [fxml:element_to_binary(El), ErrTxt]) end. @@ -585,7 +585,7 @@ make_piefxis_xml_tail() -> %% @spec () -> string() make_piefxis_server_head() -> - io_lib:format("<server-data xmlns='~s' xmlns:xi='~s'>", + io_lib:format("<server-data xmlns='~ts' xmlns:xi='~ts'>", [?NS_PIE, ?NS_XI]). %% @spec () -> string() @@ -594,7 +594,7 @@ make_piefxis_server_tail() -> %% @spec (Host::string()) -> string() make_piefxis_host_head(Host) -> - io_lib:format("<host xmlns='~s' xmlns:xi='~s' jid='~s'>", + io_lib:format("<host xmlns='~ts' xmlns:xi='~ts' jid='~ts'>", [?NS_PIE, ?NS_XI, Host]). %% @spec () -> string() @@ -604,7 +604,7 @@ make_piefxis_host_tail() -> %% @spec (Fn::string()) -> string() make_xinclude(Fn) -> Base = filename:basename(Fn), - io_lib:format("<xi:include href='~s'/>", [Base]). + io_lib:format("<xi:include href='~ts'/>", [Base]). print(Fd, String) -> file:write(Fd, String). |