mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 05:26:37 +00:00
Merge pull request #899 from tcely/patch-6
Clean up debug logs from `process_tasks`
This commit is contained in:
commit
9d3c9c4414
@ -19,12 +19,17 @@ app_logger.addHandler(default_sh)
|
|||||||
app_logger.setLevel(logging_level)
|
app_logger.setLevel(logging_level)
|
||||||
|
|
||||||
|
|
||||||
|
class NoWaitingForTasksFilter(logging.Filter):
|
||||||
|
def filter(self, record):
|
||||||
|
return 'waiting for tasks' != record.getMessage()
|
||||||
|
|
||||||
background_task_name = 'background_task.management.commands.process_tasks'
|
background_task_name = 'background_task.management.commands.process_tasks'
|
||||||
last_part = background_task_name.rsplit('.', 1)[-1]
|
last_part = background_task_name.rsplit('.', 1)[-1]
|
||||||
background_task_formatter = logging.Formatter(
|
background_task_formatter = logging.Formatter(
|
||||||
f'%(asctime)s [{last_part}/%(levelname)s] %(message)s'
|
f'%(asctime)s [{last_part}/%(levelname)s] %(message)s'
|
||||||
)
|
)
|
||||||
background_task_sh = logging.StreamHandler()
|
background_task_sh = logging.StreamHandler()
|
||||||
|
background_task_sh.addFilter(NoWaitingForTasksFilter())
|
||||||
background_task_sh.setFormatter(background_task_formatter)
|
background_task_sh.setFormatter(background_task_formatter)
|
||||||
background_task_sh.setLevel(logging_level)
|
background_task_sh.setLevel(logging_level)
|
||||||
background_task_logger = logging.getLogger(background_task_name)
|
background_task_logger = logging.getLogger(background_task_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user