aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sasl/src/sasl.erl
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-06-07 16:23:19 +0200
committerSiri Hansen <[email protected]>2018-06-11 15:01:41 +0200
commitc026109009942d7a877242f161860cc824223cf1 (patch)
tree44cae2092634830ecaab5732aacd7c142c8ebc6e /lib/sasl/src/sasl.erl
parentb91eceaf71e0009346d119346a33894ed53be7b0 (diff)
downloadotp-c026109009942d7a877242f161860cc824223cf1.tar.gz
otp-c026109009942d7a877242f161860cc824223cf1.tar.bz2
otp-c026109009942d7a877242f161860cc824223cf1.zip
[logger] Change default primary log level to 'notice'
Log events issued via error_logger:info_msg or error_logger:info_report are now forwarded to Logger with level 'notice' instead of 'info'. Log events issued by gen_* behaviours are also changed from level 'info' to level 'notice'. Progress reports are still 'info', and can therefore easily be included/excluded by changing the primary log level. By default, they are not logged.
Diffstat (limited to 'lib/sasl/src/sasl.erl')
-rw-r--r--lib/sasl/src/sasl.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/sasl/src/sasl.erl b/lib/sasl/src/sasl.erl
index ab041dbab8..5db3d75cfb 100644
--- a/lib/sasl/src/sasl.erl
+++ b/lib/sasl/src/sasl.erl
@@ -131,6 +131,10 @@ add_sasl_logger(std, undefined) -> ok;
add_sasl_logger(Dest, Level) ->
FC = #{legacy_header=>true,
single_line=>false},
+ case Level of
+ info -> allow_progress();
+ _ -> ok
+ end,
ok = logger:add_handler(sasl,logger_std_h,
#{level=>Level,
filter_default=>stop,
@@ -151,6 +155,7 @@ delete_sasl_logger(_Type) ->
add_error_logger_mf(undefined) -> ok;
add_error_logger_mf({Dir, MaxB, MaxF}) ->
+ allow_progress(),
error_logger:add_report_handler(
log_mf_h, log_mf_h:init(Dir, MaxB, MaxF, fun pred/1)).
@@ -161,6 +166,13 @@ delete_error_logger_mf(_) ->
pred({_Type, GL, _Msg}) when node(GL) =/= node() -> false;
pred(_) -> true.
+allow_progress() ->
+ #{level:=PL} = logger:get_primary_config(),
+ case logger:compare_levels(info,PL) of
+ lt -> ok = logger:set_primary_config(level,info);
+ _ -> ok
+ end.
+
%%%-----------------------------------------------------------------
%%% supervisor functionality
%%%-----------------------------------------------------------------