log refactro