log refactoring