From 2f872cdb006b80457b0ed7a6b6640974f2a2d8a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Thu, 8 Feb 2024 22:18:59 +0100 Subject: [PATCH] Rename xmpplogger into logging_sender --- appslib/{xmpplogger.py => logging_sender.py} | 7 ++++--- list_builder.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) rename appslib/{xmpplogger.py => logging_sender.py} (80%) diff --git a/appslib/xmpplogger.py b/appslib/logging_sender.py similarity index 80% rename from appslib/xmpplogger.py rename to appslib/logging_sender.py index c13faef..9cd9c80 100644 --- a/appslib/xmpplogger.py +++ b/appslib/logging_sender.py @@ -6,13 +6,14 @@ import logging import logging.handlers -class XmppLogHandler(logging.Handler): +class LogSenderHandler(logging.Handler): def __init__(self): logging.Handler.__init__(self) self.is_logging = False def emit(self, record): if which("sendxmpppy") is None: + logging.warning("Could not send error via xmpp.") return msg = f"[Applist builder error] {record.msg}" @@ -31,5 +32,5 @@ class XmppLogHandler(logging.Handler): def enable(): - """Enables the XmppLogHandler""" - XmppLogHandler.add(logging.ERROR) + """Enables the LogSenderHandler""" + LogSenderHandler.add(logging.ERROR) diff --git a/list_builder.py b/list_builder.py index 586d49b..cf746d9 100755 --- a/list_builder.py +++ b/list_builder.py @@ -17,7 +17,7 @@ import tqdm from tqdm.contrib.logging import logging_redirect_tqdm from git import Repo -import appslib.xmpplogger # pylint: disable=import-error +import appslib.logging_sender # pylint: disable=import-error from app_caches import app_cache_folder # pylint: disable=import-error from app_caches import apps_cache_update_all # pylint: disable=import-error from appslib.utils import (REPO_APPS_ROOT, # pylint: disable=import-error @@ -249,7 +249,7 @@ def build_app_dict(app, infos): def main() -> None: - appslib.xmpplogger.enable() + appslib.logging_sender.enable() apps_cache_update_all(get_catalog(), parallel=50) catalog = build_base_catalog()