Refactored loggerWrapper to reduce cyclomatic complexity