Refactor log functionality into rx