[erlang-questions] How to capture all output to console during Common Test?

Vladimir Gordeev gordeev.vladimir.v@REDACTED
Sat Jun 10 09:14:41 CEST 2017


Well, it's possible to start your own Erlang IO server, start it in ct hook
during init, and then make it as a group leader for root ct process.

http://erlang.org/doc/apps/stdlib/io_protocol.html

So just start your own process that handles io_reply, io_request, and then

erlang:group_leader(MyCustomIOServerPid, CtRootPid),

On Sat, Jun 10, 2017 at 4:09 AM, Fred Hebert <mononcqc@REDACTED> wrote:

> On 06/09, Max Lapshin wrote:
>
>> Hi.
>>
>> I'm running ct_run  and want somehow to capture all output made to console
>> (io:format,  ct:print).  Is it possible?
>>
>
> I ended up doing this for rebar3 through the cth_readable library. The
> only practical way I found to hijack all traffic was to use a parse
> transform to replace the function and tunnel it through my own.
>
> Here's the parse transform I used for ct:pal/2-3 :
> https://github.com/ferd/cth_readable/blob/master/src/cth_rea
> dable_transform.erl
>
> https://github.com/ferd/cth_readable/blob/master/src/cth_rea
> dable_failonly.erl shows how I got to capture and redirect most of lager
> and error_logger's traffic as well, but it's fairly messy.
>
> Regards,
> Fred.
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170610/cf427e29/attachment.htm>


More information about the erlang-questions mailing list