aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2015-05-29 10:52:15 +0200
committerBjörn Gustavsson <[email protected]>2015-05-29 10:52:15 +0200
commit3f652961917964b1f47a0ac62609860691bd9099 (patch)
tree69849088246ab0d044ade9104f7bbf4c75d4bd9d /lib/sasl/src
parent6635bfa7c480d33d43874f4b37b7c461ba04db23 (diff)
parent885ad5783c33d7f6115c5ad55c401102f10039d6 (diff)
downloadotp-3f652961917964b1f47a0ac62609860691bd9099.tar.gz
otp-3f652961917964b1f47a0ac62609860691bd9099.tar.bz2
otp-3f652961917964b1f47a0ac62609860691bd9099.zip
Merge branch 'saleyn/sasl/opening-modes/OTP-12778'
* saleyn/sasl/opening-modes/OTP-12778: Customize SASL error_logger file opening modes
Diffstat (limited to 'lib/sasl/src')
-rw-r--r--lib/sasl/src/sasl.erl8
-rw-r--r--lib/sasl/src/sasl_report_file_h.erl4
2 files changed, 7 insertions, 5 deletions
diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl
index fdea6da13e..4a220f0511 100644
--- a/lib/sasl/src/sasl.erl
+++ b/lib/sasl/src/sasl.erl
@@ -55,7 +55,9 @@ get_sasl_error_logger() ->
case application:get_env(sasl, sasl_error_logger) of
{ok, false} -> undefined;
{ok, tty} -> tty;
- {ok, {file, File}} when is_list(File) -> {file, File};
+ {ok, {file, File}} when is_list(File) -> {file, File, [write]};
+ {ok, {file, File, Modes}} when is_list(File), is_list(Modes) ->
+ {file, File, Modes};
{ok, Bad} -> exit({bad_config, {sasl, {sasl_error_logger, Bad}}});
_ -> undefined
end.
@@ -125,9 +127,9 @@ delete_sasl_error_logger(Type) ->
error_logger:delete_report_handler(mod(Type)).
mod(tty) -> sasl_report_tty_h;
-mod({file, _File}) -> sasl_report_file_h.
+mod({file, _File, _Modes}) -> sasl_report_file_h.
-args({file, File}, Type) -> {File, type(Type)};
+args({file, File, Modes}, Type) -> {File, Modes, type(Type)};
args(_, Type) -> type(Type).
type(error) -> error;
diff --git a/lib/sasl/src/sasl_report_file_h.erl b/lib/sasl/src/sasl_report_file_h.erl
index f42b4b5ff2..a5bd0ac055 100644
--- a/lib/sasl/src/sasl_report_file_h.erl
+++ b/lib/sasl/src/sasl_report_file_h.erl
@@ -28,9 +28,9 @@
handle_event/2, handle_call/2, handle_info/2,
terminate/2]).
-init({File, Type}) ->
+init({File, Modes, Type}) when is_list(Modes) ->
process_flag(trap_exit, true),
- case file:open(File, [write]) of
+ case file:open(File, Modes) of
{ok,Fd} ->
{ok, {Fd, File, Type}};
What ->