From fb34af114fe1daaa5e3b834130dc6fc214a5bcce Mon Sep 17 00:00:00 2001 From: Zakhar Izmaylov Date: Wed, 20 Nov 2024 15:46:46 +0300 Subject: [PATCH] Update logger --- database.py | 6 +++--- handlers/start.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/database.py b/database.py index 69a2c956..34c92602 100644 --- a/database.py +++ b/database.py @@ -108,7 +108,7 @@ async def create_coupon(coupon_code: str, amount: float, usage_limit: int): usage_limit, ) except Exception as e: - print(f"Ошибка при создании купона: {e}") + logger.error(f"Ошибка при создании купона: {e}") raise finally: await conn.close() @@ -126,7 +126,7 @@ async def get_all_coupons(): ) return coupons except Exception as e: - print(f"Ошибка при получении купонов: {e}") + logger.error(f"Ошибка при получении купонов: {e}") return [] finally: await conn.close() @@ -157,7 +157,7 @@ async def delete_coupon_from_db(coupon_code: str): return True except Exception as e: - print(f"Ошибка при удалении купона: {e}") + logger.error(f"Ошибка при удалении купона: {e}") return False finally: await conn.close() diff --git a/handlers/start.py b/handlers/start.py index bc5c002e..17cd9224 100644 --- a/handlers/start.py +++ b/handlers/start.py @@ -109,7 +109,7 @@ async def start_command(message: Message, admin: bool = False): await send_welcome_message(message.chat.id, trial_status, admin) except Exception as e: - logger.exception( + logger.error( f"Ошибка в обработке команды /start для user_id {message.from_user.id}: {e}" ) await message.answer("Произошла ошибка. Пожалуйста, попробуйте позже.")