Adds trace functionality, replacing std::cout/std::cerr