Skip to content

Commit 04b82ec

Browse files
authored
improve logging
1 parent 637d6b4 commit 04b82ec

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Simple Telegram Bot which parse .xlsx file by user message pattern"""
22

33
import os
4+
import sys
45
import logging
56
from telegram import Update
67
from telegram.ext import ApplicationBuilder, CommandHandler, ContextTypes
@@ -9,6 +10,8 @@
910
TELEGRAM_BOT_TOKEN = os.getenv("TELEGRAM_BOT_TOKEN")
1011
XLSX_FILE_PATH = os.getenv("XLSX_FILE_PATH")
1112

13+
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', stream=sys.stdout)
14+
1215
async def find(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
1316
"""Function which parse excel file by user message and send response to Telegram Bot"""
1417
if update.message and update.message.text:
@@ -40,8 +43,6 @@ async def find(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
4043
if response_message == '':
4144
response_message += "Not Found"
4245

43-
logging.info("Successfull send message to Telegram Bot!")
44-
4546
await update.message.reply_text(f"{response_message}")
4647

4748
def get_headers(sheet: any ) -> dict:
@@ -63,4 +64,3 @@ def main():
6364

6465
if __name__ == "__main__":
6566
main()
66-

0 commit comments

Comments
 (0)