Refactored logger cleaning