Refactored logger code.