Refactor logging into helper function.
Merge pull request #18 from rjackson/refactor_logging

Refactor logging into helper function.