Update logger
This commit is contained in:
+3
-3
@@ -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
@@ -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("Произошла ошибка. Пожалуйста, попробуйте позже.")
|
||||||
|
|||||||
Reference in New Issue
Block a user