pipeline.extern.logutils.queue¶
This module contains classes which help you work with queues. A typical
application is when you want to log from performance-critical threads, but
where the handlers you want to use are slow (for example,
SMTPHandler
). In that case, you can create a queue,
pass it to a QueueHandler
instance and use that instance with your
loggers. Elsewhere, you can instantiate a QueueListener
with the same
queue and some slow handlers, and call start()
on it.
This will start monitoring the queue on a separate thread and call all the
configured handlers on that thread, so that your logging thread is not held
up by the slow handlers.
Note that as well as in-process queues, you can use these classes with queues
from the multiprocessing
module.
N.B. This is part of the standard library since Python 3.2, so the version here is for use with earlier Python versions.
Classes
|
This handler sends events to a queue. |
|
This class implements an internal threaded listener which watches for LogRecords being added to a queue, removes them and passes them to a list of handlers for processing. |