Adding information to Behat output from custom context code
If using behat 3.x just print, var_dump, var_export, etc in your code. It will be caught and printed from behat
Reference: https://github.com/Behat/Behat/issues/347
Following your current "solution" you can redirect the output of console to another file. This way the original format is kept clean and valid (e.g. jUnit) and you can parse and keep further information separate.
How to redirect the output depends on you OS. E.g. you can follow http://wiki.bash-hackers.org/syntax/redirection for Bash shell on *nix Systems.