From 419bfa96687bd0f5bffc3db77af66e2bbf4f94b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Sun, 24 Mar 2024 17:18:42 +0100 Subject: [PATCH] Add python typing to logging_sender.py --- tools/appslib/logging_sender.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tools/appslib/logging_sender.py b/tools/appslib/logging_sender.py index aa5b020a..ae9fce93 100644 --- a/tools/appslib/logging_sender.py +++ b/tools/appslib/logging_sender.py @@ -5,7 +5,7 @@ import logging import logging.handlers -def notify(message, channel): +def notify(message: str, channel: str) -> None: print(f"{channel} -> {message}") chan_list = ["dev", "apps", "doc"] @@ -43,16 +43,16 @@ def notify(message, channel): class LogSenderHandler(logging.Handler): - def __init__(self): + def __init__(self) -> None: logging.Handler.__init__(self) self.is_logging = False - def emit(self, record): + def emit(self, record: logging.LogRecord) -> None: msg = f"[Apps tools error] {record.msg}" notify(msg, "dev") @classmethod - def add(cls, level=logging.ERROR): + def add(cls, level: int = logging.ERROR) -> None: if not logging.getLogger().handlers: logging.basicConfig() @@ -63,6 +63,6 @@ class LogSenderHandler(logging.Handler): logging.getLogger().handlers.append(handler) -def enable(): +def enable() -> None: """Enables the LogSenderHandler""" LogSenderHandler.add(logging.ERROR)