code: def add_log_listener(self, callback):
          
          if self.is_closed():
              raise exceptions.InterfaceError('connection is closed')
          self._log_listeners.add(callback)
docs: Add a listener for Postgres log messages.
  
          It will be called when asyncronous NoticeResponse is received
          from the connection.  Possible message types are: WARNING, NOTICE,
          DEBUG, INFO, or LOG.
  
          :param callable callback:
              A callable receiving the following arguments:
              **connection**: a Connection the callback is registered with;
              **message**: the `exceptions.PostgresLogMessage` message.
  
          .. versionadded:: 0.12.0