Factor out the logic for logging test results to the console so that other output modes can be supported