return parameter for debug method

Added $return as 4th parameter to specify whether to return the debug text or print it. It works similar to print_r function