Fix getLogger function and refactor getFormatter