aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-06-12 14:06:46 +0200
committerGitHub <[email protected]>2018-06-12 14:06:46 +0200
commit465d2849ed0d832577a25a52f0717ec5f7eb94bd (patch)
tree490304495c0562d34dc4fb7415a64deafd25f470 /lib/stdlib
parent0f752d6e9cb447552673bddebccab31539e55358 (diff)
parent8ae3b6289f25e6c283be5b0d67cd5f6c4434b6e2 (diff)
downloadotp-465d2849ed0d832577a25a52f0717ec5f7eb94bd.tar.gz
otp-465d2849ed0d832577a25a52f0717ec5f7eb94bd.tar.bz2
otp-465d2849ed0d832577a25a52f0717ec5f7eb94bd.zip
Merge pull request #1835 from sirihansen/siri/logger-fix
Diffstat (limited to 'lib/stdlib')
-rw-r--r--lib/stdlib/src/gen_event.erl4
-rw-r--r--lib/stdlib/src/gen_fsm.erl4
-rw-r--r--lib/stdlib/src/gen_server.erl4
-rw-r--r--lib/stdlib/src/gen_statem.erl2
-rw-r--r--lib/stdlib/src/proc_lib.erl2
-rw-r--r--lib/stdlib/src/supervisor.erl6
-rw-r--r--lib/stdlib/src/supervisor_bridge.erl4
-rw-r--r--lib/stdlib/test/proc_lib_SUITE.erl10
8 files changed, 19 insertions, 17 deletions
diff --git a/lib/stdlib/src/gen_event.erl b/lib/stdlib/src/gen_event.erl
index 3ee2031d02..8213282867 100644
--- a/lib/stdlib/src/gen_event.erl
+++ b/lib/stdlib/src/gen_event.erl
@@ -589,7 +589,7 @@ server_update(Handler1, Func, Event, SName) ->
?LOG_WARNING(#{label=>{gen_event,no_handle_info},
module=>Mod1,
message=>Event},
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
report_cb=>fun gen_event:format_log/1,
error_logger=>#{tag=>warning_msg}}), % warningmap??
{ok, Handler1};
@@ -751,7 +751,7 @@ report_error(Handler, Reason, State, LastIn, SName) ->
state=>format_status(terminate,Handler#handler.module,
get(),State),
reason=>Reason},
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
report_cb=>fun gen_event:format_log/1,
error_logger=>#{tag=>error}}).
diff --git a/lib/stdlib/src/gen_fsm.erl b/lib/stdlib/src/gen_fsm.erl
index 1646186761..caaaf8fa2e 100644
--- a/lib/stdlib/src/gen_fsm.erl
+++ b/lib/stdlib/src/gen_fsm.erl
@@ -505,7 +505,7 @@ handle_msg(Msg, Parent, Name, StateName, StateData, Mod, _Time, HibernateAfterTi
?LOG_WARNING(#{label=>{gen_fsm,no_handle_info},
module=>Mod,
message=>Msg},
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
report_cb=>fun gen_fsm:format_log/1,
error_logger=>#{tag=>warning_msg}}),
loop(Parent, Name, StateName, StateData, Mod, infinity, HibernateAfterTimeout, []);
@@ -616,7 +616,7 @@ error_info(Reason, Name, Msg, StateName, StateData, Debug) ->
state_name=>StateName,
state_data=>StateData,
reason=>Reason},
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
report_cb=>fun gen_fsm:format_log/1,
error_logger=>#{tag=>error}}),
sys:print_log(Debug),
diff --git a/lib/stdlib/src/gen_server.erl b/lib/stdlib/src/gen_server.erl
index 09f77c0810..342cc2a8e3 100644
--- a/lib/stdlib/src/gen_server.erl
+++ b/lib/stdlib/src/gen_server.erl
@@ -645,7 +645,7 @@ try_dispatch(Mod, Func, Msg, State) ->
#{label=>{gen_server,no_handle_info},
module=>Mod,
message=>Msg},
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
report_cb=>fun gen_server:format_log/1,
error_logger=>#{tag=>warning_msg}}),
{ok, {noreply, State}};
@@ -891,7 +891,7 @@ error_info(Reason, Name, From, Msg, Mod, State, Debug) ->
state=>format_status(terminate, Mod, get(), State),
reason=>Reason,
client_info=>client_stacktrace(From)},
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
report_cb=>fun gen_server:format_log/1,
error_logger=>#{tag=>error}}),
sys:print_log(Debug),
diff --git a/lib/stdlib/src/gen_statem.erl b/lib/stdlib/src/gen_statem.erl
index b36b8cd5a5..19d22f24f0 100644
--- a/lib/stdlib/src/gen_statem.erl
+++ b/lib/stdlib/src/gen_statem.erl
@@ -1900,7 +1900,7 @@ error_info(
state_enter=>StateEnter,
state=>format_status(terminate, get(), S),
reason=>{Class,Reason,Stacktrace}},
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
report_cb=>fun gen_statem:format_log/1,
error_logger=>#{tag=>error}}).
diff --git a/lib/stdlib/src/proc_lib.erl b/lib/stdlib/src/proc_lib.erl
index 5f14e78f91..cca1628aba 100644
--- a/lib/stdlib/src/proc_lib.erl
+++ b/lib/stdlib/src/proc_lib.erl
@@ -508,7 +508,7 @@ crash_report(Class, Reason, StartF, Stacktrace) ->
?LOG_ERROR(#{label=>{proc_lib,crash},
report=>[my_info(Class, Reason, StartF, Stacktrace),
linked_info(self())]},
- #{domain=>[beam,erlang,otp,sasl],
+ #{domain=>[otp,sasl],
report_cb=>fun proc_lib:report_cb/1,
logger_formatter=>#{title=>"CRASH REPORT"},
error_logger=>#{tag=>error_report,type=>crash_report}}).
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index eb46ac611a..9b6c2a5f0b 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -43,7 +43,7 @@
{errorContext,Error},
{reason,Reason},
{offender,extract_child(Child)}]},
- #{domain=>[beam,erlang,otp,sasl],
+ #{domain=>[otp,sasl],
report_cb=>fun logger:format_otp_report/1,
logger_formatter=>#{title=>"SUPERVISOR REPORT"},
error_logger=>#{tag=>error_report,
@@ -580,7 +580,7 @@ handle_info({'EXIT', Pid, Reason}, State) ->
handle_info(Msg, State) ->
?LOG_ERROR("Supervisor received unexpected message: ~tp~n",[Msg],
- #{domain=>[beam,erlang,otp],
+ #{domain=>[otp],
error_logger=>#{tag=>error}}),
{noreply, State}.
@@ -1419,7 +1419,7 @@ report_progress(Child, SupName) ->
?LOG_INFO(#{label=>{supervisor,progress},
report=>[{supervisor,SupName},
{started,extract_child(Child)}]},
- #{domain=>[beam,erlang,otp,sasl],
+ #{domain=>[otp,sasl],
report_cb=>fun logger:format_otp_report/1,
logger_formatter=>#{title=>"PROGRESS REPORT"},
error_logger=>#{tag=>info_report,type=>progress}}).
diff --git a/lib/stdlib/src/supervisor_bridge.erl b/lib/stdlib/src/supervisor_bridge.erl
index 39372935fa..2db0a895d6 100644
--- a/lib/stdlib/src/supervisor_bridge.erl
+++ b/lib/stdlib/src/supervisor_bridge.erl
@@ -135,7 +135,7 @@ report_progress(Pid, Mod, StartArgs, SupName) ->
report=>[{supervisor, SupName},
{started, [{pid, Pid},
{mfa, {Mod, init, [StartArgs]}}]}]},
- #{domain=>[beam,erlang,otp,sasl],
+ #{domain=>[otp,sasl],
report_cb=>fun logger:format_otp_report/1,
logger_formatter=>#{title=>"PROGRESS REPORT"},
error_logger=>#{tag=>info_report,type=>progress}}).
@@ -146,7 +146,7 @@ report_error(Error, Reason, #state{name = Name, pid = Pid, mod = Mod}) ->
{errorContext, Error},
{reason, Reason},
{offender, [{pid, Pid}, {mod, Mod}]}]},
- #{domain=>[beam,erlang,otp,sasl],
+ #{domain=>[otp,sasl],
report_cb=>fun logger:format_otp_report/1,
logger_formatter=>#{title=>"SUPERVISOR REPORT"},
error_logger=>#{tag=>error_report,type=>supervisor_report}}).
diff --git a/lib/stdlib/test/proc_lib_SUITE.erl b/lib/stdlib/test/proc_lib_SUITE.erl
index 81bf9020b8..a283aa992f 100644
--- a/lib/stdlib/test/proc_lib_SUITE.erl
+++ b/lib/stdlib/test/proc_lib_SUITE.erl
@@ -542,13 +542,14 @@ system_terminate(Reason,_Parent,_Deb,_State) ->
t_format(_Config) ->
- logger:add_handler_filter(logger_std_h,stop_all,{fun(_,_) -> stop end,ok}),
+ {ok,#{level:=Level}} = logger:get_handler_config(default),
+ logger:set_handler_config(default,level,none),
error_logger:add_report_handler(?MODULE, self()),
try
t_format()
after
error_logger:delete_report_handler(?MODULE),
- logger:remove_handler_filter(logger_std_h,stop_all)
+ logger:set_handler_config(default,level,Level)
end,
ok.
@@ -585,11 +586,12 @@ t_format() ->
ok.
t_format_arbitrary(_Config) ->
- logger:add_handler_filter(logger_std_h,stop_all,{fun(_,_) -> stop end,ok}),
+ {ok,#{level:=Level}} = logger:get_handler_config(default),
+ logger:set_handler_config(default,level,none),
try
t_format_arbitrary()
after
- logger:remove_handler_filter(logger_std_h,stop_all)
+ logger:set_handler_config(default,level,Level)
end,
ok.