core.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:agentzero 作者: gabrielfalcao 项目源码 文件源码
def get_log_handler(self, socket_name, topic_name='logs'):
        """returns an instance of :py:class:ZMQPubHandler attached to a previously-created socket.

        :param socket_name: the name of the socket, previously created with :py:meth:SocketManager.create
        :param topic_name: the name of the topic in which the logs will be PUBlished

        **Example:**

        ::

          >>> import zmq
          >>> from agentzero.core import SocketManager
          >>>
          >>> sockets = SocketManager()
          >>> sockets.ensure_and_bind('logs', zmq.PUB, 'tcp://*:6000', zmq.POLLOUT)
          >>> app_logger = sockets.get_logger('logs', logger_name='myapp'))
          >>> app_logger.info("Server is up!")
          >>> try:
                  url = sockets.recv_safe('download_queue')
          ...     requests.get(url)
          ... except:
          ...     app_logger.exception('failed to download url: %s', url)
        """
        return ZMQPubHandler(self, socket_name, topic_name)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号