logging function revisions and refactoring