Log refactoring