Tidy up logging code.