refactoring logging