Refactor shader logging to reduce code duplication

Some tests that did not include shader logging before also get shader
logging.