Update logger

This commit is contained in:
Zakhar Izmaylov
2024-11-20 15:46:46 +03:00
parent 6d4c98b901
commit 187daba997
2 changed files with 4 additions and 4 deletions
+3 -3
View File
@@ -108,7 +108,7 @@ async def create_coupon(coupon_code: str, amount: float, usage_limit: int):
usage_limit, usage_limit,
) )
except Exception as e: except Exception as e:
print(f"Ошибка при создании купона: {e}") logger.error(f"Ошибка при создании купона: {e}")
raise raise
finally: finally:
await conn.close() await conn.close()
@@ -126,7 +126,7 @@ async def get_all_coupons():
) )
return coupons return coupons
except Exception as e: except Exception as e:
print(f"Ошибка при получении купонов: {e}") logger.error(f"Ошибка при получении купонов: {e}")
return [] return []
finally: finally:
await conn.close() await conn.close()
@@ -157,7 +157,7 @@ async def delete_coupon_from_db(coupon_code: str):
return True return True
except Exception as e: except Exception as e:
print(f"Ошибка при удалении купона: {e}") logger.error(f"Ошибка при удалении купона: {e}")
return False return False
finally: finally:
await conn.close() await conn.close()
+1 -1
View File
@@ -109,7 +109,7 @@ async def start_command(message: Message, admin: bool = False):
await send_welcome_message(message.chat.id, trial_status, admin) await send_welcome_message(message.chat.id, trial_status, admin)
except Exception as e: except Exception as e:
logger.exception( logger.error(
f"Ошибка в обработке команды /start для user_id {message.from_user.id}: {e}" f"Ошибка в обработке команды /start для user_id {message.from_user.id}: {e}"
) )
await message.answer("Произошла ошибка. Пожалуйста, попробуйте позже.") await message.answer("Произошла ошибка. Пожалуйста, попробуйте позже.")