From dfa46a0cc2a98eafb8cc3301dad63cef6d37d960 Mon Sep 17 00:00:00 2001 From: hikariatama Date: Wed, 3 Aug 2022 13:52:18 +0000 Subject: [PATCH] 1.3.0 - Replace `print` with `logging.info` in main script to make url visible in logs --- CHANGELOG.md | 1 + hikka/main.py | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index faef751..e37dbde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - Add support for command translate directly in decorator (`@loader.command(ru_doc="Привет")`) - Add support for :obj:`aiogram.types.Message` in `utils.get_chat_id` - Add human-readable error message when trying to unload core module +- Replace `print` with `logging.info` in main script to make url visible in logs ## 🌑 Hikka 1.2.12 diff --git a/hikka/main.py b/hikka/main.py index 2ea9cb4..701f4f8 100755 --- a/hikka/main.py +++ b/hikka/main.py @@ -436,8 +436,8 @@ class Hikka: async def _web_banner(self): """Shows web banner""" - print("✅ Web mode ready for configuration") - print(f"🌐 Please visit {self.web.url}") + logging.info("✅ Web mode ready for configuration") + logging.info(f"🌐 Please visit {self.web.url}") async def wait_for_web_auth(self, token: str): """Waits for web auth confirmation in Telegram""" @@ -516,7 +516,7 @@ class Hikka: self.clients += [client] except sqlite3.OperationalError: - print( + logging.error( "Check that this is the only instance running. " f"If that doesn't help, delete the file named '{session}'" ) @@ -529,13 +529,13 @@ class Hikka: run_config({}, self.arguments.data_root) return False except PhoneNumberInvalidError: - print( + logging.error( "Phone number is incorrect. Use international format (+XX...) " "and don't put spaces in it." ) self.sessions.remove(session) except InteractiveAuthRequired: - print(f"Session {session} was terminated and re-auth is required") + logging.error(f"Session {session} was terminated and re-auth is required") self.sessions.remove(session) return bool(self.sessions) @@ -593,7 +593,7 @@ class Hikka: ) self.omit_log = True - print(f"- Started for {client._tg_id} -") + logging.info(f"- Started for {client._tg_id} -") except Exception: logging.exception("Badge error")