Refactor an logger