Make logging error object optional, add tests for option