Check that self.logger exists

`self.logger` is initialized as `None` and there is no guarantee that users have set it, so check that it exists before trying to pass messages to it