From cd5484ef88262d2929df488a217866a072e2ead3 Mon Sep 17 00:00:00 2001 From: flifloo Date: Thu, 26 Dec 2019 14:21:03 +0100 Subject: [PATCH] User logger child for each module --- TelegramEDT/await_cmd.py | 1 + TelegramEDT/basic.py | 2 ++ TelegramEDT/edt.py | 2 ++ TelegramEDT/kfet.py | 2 ++ TelegramEDT/modules.py | 2 ++ TelegramEDT/notif.py | 2 ++ TelegramEDT/tomuss.py | 2 ++ TelegramEDT/tools.py | 2 ++ 8 files changed, 15 insertions(+) diff --git a/TelegramEDT/await_cmd.py b/TelegramEDT/await_cmd.py index fa7f3eb..9de987d 100644 --- a/TelegramEDT/await_cmd.py +++ b/TelegramEDT/await_cmd.py @@ -15,6 +15,7 @@ from TelegramEDT.base import User from TelegramEDT.lang import lang re_url = re.compile(r"http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+") +logger = logger.getChild("await_cmd") def have_await_cmd(msg: types.Message): diff --git a/TelegramEDT/basic.py b/TelegramEDT/basic.py index 0fecc0c..861984c 100644 --- a/TelegramEDT/basic.py +++ b/TelegramEDT/basic.py @@ -5,6 +5,8 @@ from TelegramEDT import dbL, dp, key, logger, session, check_id from TelegramEDT.base import User from TelegramEDT.lang import lang +logger = logger.getChild("basic") + async def start(message: types.Message): check_id(message.from_user) diff --git a/TelegramEDT/edt.py b/TelegramEDT/edt.py index 78b12b6..47edf33 100644 --- a/TelegramEDT/edt.py +++ b/TelegramEDT/edt.py @@ -8,6 +8,8 @@ from TelegramEDT import dbL, dp, key, logger, posts_cb, session, TIMES, bot, che from TelegramEDT.base import User from TelegramEDT.lang import lang +logger = logger.getChild("edt") + def calendar(time: str, user_id: int): with dbL: diff --git a/TelegramEDT/kfet.py b/TelegramEDT/kfet.py index d8b8696..2367ec4 100644 --- a/TelegramEDT/kfet.py +++ b/TelegramEDT/kfet.py @@ -9,6 +9,8 @@ from TelegramEDT import dbL, dp, key, logger, session, check_id from TelegramEDT.base import User, KFET_URL from TelegramEDT.lang import lang +logger = logger.getChild("kfet") + def get_now(): return datetime.datetime.now(datetime.timezone.utc).astimezone(tz=None) diff --git a/TelegramEDT/modules.py b/TelegramEDT/modules.py index 4f7485f..9351ac1 100644 --- a/TelegramEDT/modules.py +++ b/TelegramEDT/modules.py @@ -4,6 +4,8 @@ from aiogram.types import Message from TelegramEDT import ADMIN_ID, logger +logger = logger.getChild("modules") + def load_module(module: str) -> bool: try: diff --git a/TelegramEDT/notif.py b/TelegramEDT/notif.py index d68a408..b79f000 100644 --- a/TelegramEDT/notif.py +++ b/TelegramEDT/notif.py @@ -8,6 +8,8 @@ from TelegramEDT import bot, dbL, dp, logger, posts_cb, session, check_id from TelegramEDT.base import User from TelegramEDT.lang import lang +logger = logger.getChild("notif") + async def notif(): while True: diff --git a/TelegramEDT/tomuss.py b/TelegramEDT/tomuss.py index c711b13..04973ec 100644 --- a/TelegramEDT/tomuss.py +++ b/TelegramEDT/tomuss.py @@ -5,6 +5,8 @@ from TelegramEDT import dbL, dp, key, logger, session, check_id from TelegramEDT.base import User from TelegramEDT.lang import lang +logger = logger.getChild("tomuss") + async def settomuss(message: types.Message): check_id(message.from_user) diff --git a/TelegramEDT/tools.py b/TelegramEDT/tools.py index db580ce..74c26ec 100644 --- a/TelegramEDT/tools.py +++ b/TelegramEDT/tools.py @@ -6,6 +6,8 @@ from aiogram.utils.exceptions import MessageIsTooLong from TelegramEDT import ADMIN_ID, bot, dbL, dp, key, log_date, logger, session, check_id from TelegramEDT.base import User +logger = logger.getChild("tools") + async def get_id(message: types.Message): check_id(message.from_user)