Logging refactoring