reimplement/revert API for capturing print statements from console