aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2018-12-21 12:35:07 +0100
committerSiri Hansen <[email protected]>2019-01-16 09:59:24 +0100
commit4ec6d337da40599b5153c7878d329ca1045b6a35 (patch)
tree9183d5127e255f5c9868035c9124e753559ba983 /lib
parent95116d41a6a7fd062d89ee67cfee90cae6fb9ad0 (diff)
downloadotp-4ec6d337da40599b5153c7878d329ca1045b6a35.tar.gz
otp-4ec6d337da40599b5153c7878d329ca1045b6a35.tar.bz2
otp-4ec6d337da40599b5153c7878d329ca1045b6a35.zip
[logger] Allow logger_olp callbacks to return {stop,...}
Diffstat (limited to 'lib')
-rw-r--r--lib/kernel/src/logger_olp.erl12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/kernel/src/logger_olp.erl b/lib/kernel/src/logger_olp.erl
index f35577d43a..0f9314b4a3 100644
--- a/lib/kernel/src/logger_olp.erl
+++ b/lib/kernel/src/logger_olp.erl
@@ -255,7 +255,11 @@ handle_call(Msg, From, #{module:=Module,cb_state:=CBState}=State) ->
{reply,Reply,CBState1} ->
reply_return(Reply,State#{cb_state=>CBState1});
{noreply,CBState1} ->
- noreply_return(State#{cb_state=>CBState1})
+ noreply_return(State#{cb_state=>CBState1});
+ {stop, Reason, Reply, CBState1} ->
+ {stop, Reason, Reply, State#{cb_state=>CBState1}};
+ {stop, Reason, CBState1} ->
+ {stop, Reason, State#{cb_state=>CBState1}}
end.
%% This is the asynchronous load event.
@@ -266,7 +270,9 @@ handle_cast({'$olp_load', Msg}, State) ->
handle_cast(Msg, #{module:=Module, cb_state:=CBState} = State) ->
case try_callback_call(Module,handle_cast,[Msg, CBState]) of
{noreply,CBState1} ->
- noreply_return(State#{cb_state=>CBState1})
+ noreply_return(State#{cb_state=>CBState1});
+ {stop, Reason, CBState1} ->
+ {stop, Reason, State#{cb_state=>CBState1}}
end.
handle_info(timeout, #{mode_ref:=_ModeRef, mode:=Mode} = State) ->
@@ -279,6 +285,8 @@ handle_info(Msg, #{module := Module, cb_state := CBState} = State) ->
case try_callback_call(Module,handle_info,[Msg, CBState]) of
{noreply,CBState1} ->
noreply_return(State#{cb_state=>CBState1});
+ {stop, Reason, CBState1} ->
+ {stop, Reason, State#{cb_state=>CBState1}};
{load,CBState1} ->
{_,State1} = do_load(Msg, cast, State#{idle=>false,
cb_state=>CBState1}),