Ejemplo n.º 1
0
 def send_back():
     handler = MultiProcessingHandler(queue)
     handler.push_thread()
     try:
         logbook.warn(message)
     finally:
         handler.pop_thread()
Ejemplo n.º 2
0
def start_logging_in_process(queue):
    """
    Start logging in multiprocessing process
    """
    if queue is not None:
        mp_handler = MultiProcessingHandler(queue)
        mp_handler.push_application()
Ejemplo n.º 3
0
 def __call__(self):
     from logbook.queues import MultiProcessingHandler
     handler = MultiProcessingHandler(self.queue)
     handler.push_thread()
     try:
         logbook.warn('Hello World')
     finally:
         handler.pop_thread()
Ejemplo n.º 4
0
def enable_multiprocess_log_handing(args):
    """
    Set up logging when using multiprocessing
    """
    normal_handler = log_handler(args, thread_wrapping=False)
    manager = multiprocessing.Manager()
    queue = manager.Queue(-1)
    mp_handler = MultiProcessingHandler(queue)
    mp_handler.push_application()
    mp_sub = MultiProcessingSubscriber(queue)
    mp_sub.dispatch_in_background(normal_handler)
    return queue
Ejemplo n.º 5
0
 def __call__(self):
     from logbook.queues import MultiProcessingHandler
     handler = MultiProcessingHandler(self.queue)
     handler.push_thread()
     try:
         logbook.warn('Hello World')
     finally:
         handler.pop_thread()
Ejemplo n.º 6
0
def setup_logging(queue: mp.Queue):
    logbook.set_datetime_format("local")
    handler = MultiProcessingHandler(queue)
    handler.push_application()
Ejemplo n.º 7
0
 def __call__(self):
     from logbook.queues import MultiProcessingHandler
     with MultiProcessingHandler(self.queue):
         logbook.warn(self.message)