mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 19:34:06 +02:00
Revert "queuelogger: set thread name"
This reverts commit 73c6674306599000281064b599545aaaa24a5448. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
0df40b43e8
commit
e1ba7c17ce
@ -4,7 +4,6 @@
|
|||||||
#
|
#
|
||||||
# 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, time
|
||||||
import chelper
|
|
||||||
|
|
||||||
# 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):
|
||||||
@ -26,15 +25,11 @@ 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)
|
||||||
_, ffi_lib = chelper.get_ffi()
|
|
||||||
self._set_thread_name = ffi_lib.set_thread_name
|
|
||||||
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 = {}
|
||||||
def _bg_thread(self):
|
def _bg_thread(self):
|
||||||
name_short = "queuelogger"[:15]
|
|
||||||
self._set_thread_name(name_short.encode('utf-8'))
|
|
||||||
while 1:
|
while 1:
|
||||||
record = self.bg_queue.get(True)
|
record = self.bg_queue.get(True)
|
||||||
if record is None:
|
if record is None:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user