diff --git a/generate/bot-generate.py b/generate/bot-generate.py index afb306c..05efb41 100644 --- a/generate/bot-generate.py +++ b/generate/bot-generate.py @@ -5,7 +5,8 @@ from prometheus_client import start_http_server, Counter, Gauge import logging -logging.basicConfig(level=logging.INFO, format='%(name)s - %(levelname)s - %(message)s') +logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s') +logger = logging.getLogger(__name__) bot=telebot.TeleBot(os.environ.get('generate_bot')) @@ -21,6 +22,7 @@ def escape_markdown(text): Функция для экранирования специальных символов в тексте для форматирования MarkdownV2. """ escape_chars = r'_*[]()~`>#+-=|{}.!' # Список символов, которые необходимо экранировать + logger.info('def escape_markdown. Escaping markdown for text: %s', text) LAST.set_to_current_time() return ''.join('\\' + char if char in escape_chars else char for char in text) @@ -43,6 +45,7 @@ def generate_nickname(message): adjective = random.choice(adjectives) animal = random.choice(animals) nickname = f'{adjective}_{animal}' + logger.info('def generate_nickname. Escaping markdown for text: %s', nickname) bot.send_message(message.chat.id, f'Your nickname:\n```\n{nickname}\n```', parse_mode='MarkdownV2') @bot.message_handler(commands=['generate_password'])