Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0055c42

Browse files
committed
Tidied example script.
1 parent 8552d1f commit 0055c42

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Doc/library/logging.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2647,14 +2647,17 @@ socket is created separately and passed to the handler (as its 'queue')::
26472647
data = json.dumps(record.__dict__)
26482648
self.queue.send(data)
26492649

2650+
handler = ZeroMQSocketHandler(sock)
2651+
2652+
26502653
Of course there are other ways of organizing this, for example passing in the
26512654
data needed by the handler to create the socket::
26522655

26532656
class ZeroMQSocketHandler(QueueHandler):
26542657
def __init__(self, uri, socktype=zmq.PUB, ctx=None):
26552658
self.ctx = ctx or zmq.Context()
26562659
socket = zmq.Socket(self.ctx, socktype)
2657-
super(ZeroMQSocketHandler, self).__init__(socket)
2660+
QueueHandler.__init__(self, socket)
26582661

26592662
def enqueue(self, record):
26602663
data = json.dumps(record.__dict__)

0 commit comments

Comments
 (0)