Refactored logger handling and added an old unit test.