Logger refactoring and testing