[erlang-questions] how to trace gen_servers?

Ulf Wiger (TN/EAB) ulf.wiger@REDACTED
Wed Nov 28 22:20:14 CET 2007


Scott Lystig Fritchie skrev:
> 
> That's the way dicts look.  Ulf Wiger's recently-discussed shell
> hackery wouldn't make those look any different, because (AFAIK) his
> shell hooks wouldn't be called by io_lib:format() or whatever is doing
> that formatting.

Actually, it might. (:

At least I started looking at that. I was trying to come up with a
good way for e.g. dict to register an output filter, so that each
shell instance would automatically (configurably) pick it up.

Each call to io:format(Format, Args) actually results in a message,
{put_chars,io_lib,format,[Format,Args]} to an io server, so it could
of course be trapped and in part diverted to io_lib_pretty:print(Term,
...), which is the function that is able to do the filtering.

The problem lies in that the Erlang IO subsystem is so pluggable,
that it's difficult to know just what code is going to process
the io_request, and for what purpose. In many cases, automatic
filtering could be every bit as bad as it would be to automatically
truncate the output and replace with "...", as the shell tends
to do. Finding out how to turn on filtering in just the right
processes, and only when desired, was the tricky part, which
I decided to leave for (much) later.

BR,
Ulf W



More information about the erlang-questions mailing list