- Replace `print` with `logging.info` in main script to make url visible in logs
pull/1/head
hikariatama 2022-08-03 13:52:18 +00:00
parent 65e05e578e
commit dfa46a0cc2
2 changed files with 7 additions and 6 deletions

View File

@ -28,6 +28,7 @@
- Add support for command translate directly in decorator (`@loader.command(ru_doc="Привет")`) - 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 support for :obj:`aiogram.types.Message` in `utils.get_chat_id`
- Add human-readable error message when trying to unload core module - 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 ## 🌑 Hikka 1.2.12

View File

@ -436,8 +436,8 @@ class Hikka:
async def _web_banner(self): async def _web_banner(self):
"""Shows web banner""" """Shows web banner"""
print("✅ Web mode ready for configuration") logging.info("✅ Web mode ready for configuration")
print(f"🌐 Please visit {self.web.url}") logging.info(f"🌐 Please visit {self.web.url}")
async def wait_for_web_auth(self, token: str): async def wait_for_web_auth(self, token: str):
"""Waits for web auth confirmation in Telegram""" """Waits for web auth confirmation in Telegram"""
@ -516,7 +516,7 @@ class Hikka:
self.clients += [client] self.clients += [client]
except sqlite3.OperationalError: except sqlite3.OperationalError:
print( logging.error(
"Check that this is the only instance running. " "Check that this is the only instance running. "
f"If that doesn't help, delete the file named '{session}'" f"If that doesn't help, delete the file named '{session}'"
) )
@ -529,13 +529,13 @@ class Hikka:
run_config({}, self.arguments.data_root) run_config({}, self.arguments.data_root)
return False return False
except PhoneNumberInvalidError: except PhoneNumberInvalidError:
print( logging.error(
"Phone number is incorrect. Use international format (+XX...) " "Phone number is incorrect. Use international format (+XX...) "
"and don't put spaces in it." "and don't put spaces in it."
) )
self.sessions.remove(session) self.sessions.remove(session)
except InteractiveAuthRequired: 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) self.sessions.remove(session)
return bool(self.sessions) return bool(self.sessions)
@ -593,7 +593,7 @@ class Hikka:
) )
self.omit_log = True self.omit_log = True
print(f"- Started for {client._tg_id} -") logging.info(f"- Started for {client._tg_id} -")
except Exception: except Exception:
logging.exception("Badge error") logging.exception("Badge error")