Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/zmq/log/__pycache__/handlers.cpython-39.pyc
Ðазад
a a�h@ � @ s� d Z ddlZddlmZmZmZmZmZ ddlZddlm Z m Z mZ dZG dd� dej �ZG dd � d ej�Zd �� D ] Zeeje�Zeeedd� � qtdS ) an pyzmq logging handlers. This mainly defines the PUBHandler object for publishing logging messages over a zmq.PUB socket. The PUBHandler can be used with the regular logging module, as in:: >>> import logging >>> handler = PUBHandler('tcp://127.0.0.1:12345') >>> handler.root_topic = 'foo' >>> logger = logging.getLogger('foobar') >>> logger.setLevel(logging.DEBUG) >>> logger.addHandler(handler) After this point, all messages logged by ``logger`` will be published on the PUB socket. Code adapted from StarCluster: http://github.com/jtriley/StarCluster/blob/master/starcluster/logger.py � N)�INFO�DEBUG�WARN�ERROR�FATAL)�bytes�unicode� cast_bytesz::c @ s^ e Zd ZdZdZddd�Zedd� �Zejdd� �Zd d � Z e jfdd�Zd d� Z dd� ZdS )� PUBHandlera| A basic logging handler that emits log messages through a PUB socket. Takes a PUB socket already bound to interfaces or an interface to bind to. Example:: sock = context.socket(zmq.PUB) sock.bind('inproc://log') handler = PUBHandler(sock) Or:: handler = PUBHandler('inproc://loc') These are equivalent. Log messages handled by this handler are broadcast with ZMQ topics ``this.root_topic`` comes first, followed by the log level (DEBUG,INFO,etc.), followed by any additional subtopics specified in the message by: log.debug("subtopic.subsub::the real message") N� c C s� t j�| � || _t jt �d�t jt �d�t jt �d�t jt �d�t j t �d�i| _ t|tj �rr|| _| jj| _n*|p|t�� | _| j�tj�| _| j�|� d S )Nz4%(levelname)s %(filename)s:%(lineno)d - %(message)s z%(message)s zC%(levelname)s %(filename)s:%(lineno)d - %(message)s - %(exc_info)s )�logging�Handler�__init__�_root_topicr � Formatterr r r �CRITICAL� formatters� isinstance�zmqZSocket�socket�context�ctx�ContextZPUB�bind)�selfZinterface_or_socketr � root_topic� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/zmq/log/handlers.pyr ? s, ����� zPUBHandler.__init__c C s | j S �N�r )r r r r r T s zPUBHandler.root_topicc C s | � |� d S r )�setRootTopic)r �valuer r r r X s c C s || _ dS )a| Set the root topic for this handler. This value is prepended to all messages published by this handler, and it defaults to the empty string ''. When you subscribe to this socket, you must set your subscription to an empty string, or to at least the first letter of the binary representation of this string to ensure you receive any messages from this handler. If you use the default empty string root topic, messages will begin with the binary representation of the log level string (INFO, WARN, etc.). Note that ZMQ SUB sockets can have multiple subscriptions. Nr )r r r r r r \ s zPUBHandler.setRootTopicc C s4 |t jkr&| j�� D ]}|| j|<