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

Fred Hebert mononcqc@REDACTED
Sat Jun 10 03:09:26 CEST 2017

On 06/09, Max Lapshin wrote:
>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 :

shows how I got to capture and redirect most of lager and error_logger's 
traffic as well, but it's fairly messy.


More information about the erlang-questions mailing list