Refactored out common parts of XCTest and SenTestingKit logging functions