refactor test failure logging