aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2017-08-22 15:26:02 +0200
committerSiri Hansen <[email protected]>2017-09-05 11:29:10 +0200
commit2d553a01258416bc977b5afd06f83f22c3ac9ab4 (patch)
tree4cec63084c8de714e1b30c668e701b6e5457700a /lib/sasl/src
parent9692bb3126332160cc4eda1f24163f88f5a57672 (diff)
downloadotp-2d553a01258416bc977b5afd06f83f22c3ac9ab4.tar.gz
otp-2d553a01258416bc977b5afd06f83f22c3ac9ab4.tar.bz2
otp-2d553a01258416bc977b5afd06f83f22c3ac9ab4.zip
sasl: set encoding of SASL report log
This can now be explicitly set by the 'sasl_error_logger' configuration parameter, but if not set, the default encoding is now utf8. When printing to this log, the Unicode translation modifier, t, might be used in the format string.
Diffstat (limited to 'lib/sasl/src')
-rw-r--r--lib/sasl/src/sasl_report_file_h.erl16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/sasl/src/sasl_report_file_h.erl b/lib/sasl/src/sasl_report_file_h.erl
index 21746839fa..d3b5c7dc0d 100644
--- a/lib/sasl/src/sasl_report_file_h.erl
+++ b/lib/sasl/src/sasl_report_file_h.erl
@@ -29,15 +29,27 @@
handle_event/2, handle_call/2, handle_info/2,
terminate/2]).
-init({File, Modes, Type}) when is_list(Modes) ->
+init({File, Modes0, Type}) when is_list(Modes0) ->
process_flag(trap_exit, true),
+ Modes1 =
+ case lists:keymember(encoding,1,Modes0) of
+ true -> Modes0;
+ false -> [{encoding,utf8}|Modes0]
+ end,
+ Modes =
+ case [M || M <- Modes1, lists:member(M,[write,append,exclusive])] of
+ [] ->
+ [write|Modes1];
+ _ ->
+ Modes1
+ end,
case file:open(File, Modes) of
{ok,Fd} ->
{ok, {Fd, File, Type}};
What ->
What
end.
-
+
handle_event({_Type, GL, _Msg}, State) when node(GL) /= node() ->
{ok, State};
handle_event(Event, {Fd, File, Type}) ->