Refactor duplicated #log method