Refactor the error logger A BIT.