logging refactoring