I have a custom function taking long time to execute. I want to see what\'s output and at the same time setting the output to a variable so that it can be post-processed.