queuelogger: Use "import Queue as queue" for improved Python3 compatibility

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-06-12 10:11:34 -04:00
parent 4905667ee2
commit 40da3f406a
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@
# Copyright (C) 2016-2019 Kevin O'Connor <kevin@koconnor.net> # Copyright (C) 2016-2019 Kevin O'Connor <kevin@koconnor.net>
# #
# This file may be distributed under the terms of the GNU GPLv3 license. # This file may be distributed under the terms of the GNU GPLv3 license.
import logging, logging.handlers, threading, Queue, time import logging, logging.handlers, threading, Queue as queue, time
# Class to forward all messages through a queue to a background thread # Class to forward all messages through a queue to a background thread
class QueueHandler(logging.Handler): class QueueHandler(logging.Handler):
@ -25,7 +25,7 @@ class QueueListener(logging.handlers.TimedRotatingFileHandler):
def __init__(self, filename): def __init__(self, filename):
logging.handlers.TimedRotatingFileHandler.__init__( logging.handlers.TimedRotatingFileHandler.__init__(
self, filename, when='midnight', backupCount=5) self, filename, when='midnight', backupCount=5)
self.bg_queue = Queue.Queue() self.bg_queue = queue.Queue()
self.bg_thread = threading.Thread(target=self._bg_thread) self.bg_thread = threading.Thread(target=self._bg_thread)
self.bg_thread.start() self.bg_thread.start()
self.rollover_info = {} self.rollover_info = {}