tidied up logging codes
Merge pull request #815 from andytaylor/master

tidied up logging codes