my debug handler won't stick
Vance Shipley
vances@REDACTED
Tue Jan 2 04:33:56 CET 2001
The sys module has a function to install a custom debug
function which will be called whenever a system event is
generated. It is defined as:
sys:install(Name, Func, FuncState) -> done | NewFuncState
So I create a debug function like this:
dbg_fun(FuncState, Event, ProcState) ->
io:fwrite("~w ~w ~w~n", [FuncState, Event, ProcState]),
FuncState.
and install it with:
sys:install(testing, {test, dbg_fun}, foo)
Now the next time I send a message ('bar') to testing I get:
foo {in, {'$gen_event', bar}} {testing, state1}
Which is great however subsequent messages don't result in
dbg_fun getting called. The documentation says:
Func is called whenever a system event is generated.
This function should return done, or a new func state.
In the first case, the function is removed. It is removed
if the function fails.
I assume that FuncState is used to do things like keep counters,
or file names etc. as persistant data through subsequent calls.
It is of type term. My read is that it should stay put unless
I return 'done'.
What am I doing wrong?
-Vance
More information about the erlang-questions
mailing list