🔊 better logging
This commit is contained in:
parent
04757a3f6a
commit
e4893a22c2
1 changed files with 4 additions and 4 deletions
|
@ -105,9 +105,9 @@ The link will be valid for 7 days.""".format(os.getenv("REGISTRATION_URL") + res
|
||||||
# Send the email
|
# Send the email
|
||||||
server.sendmail(sender_email, receiver_email, msg.as_string())
|
server.sendmail(sender_email, receiver_email, msg.as_string())
|
||||||
|
|
||||||
print("Email sent successfully")
|
logging.info("Email sent successfully")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error: {e}")
|
logging.error("Error sending mail: {}".format(e))
|
||||||
finally:
|
finally:
|
||||||
# Close the connection
|
# Close the connection
|
||||||
server.quit()
|
server.quit()
|
||||||
|
@ -118,7 +118,7 @@ while True:
|
||||||
bot.run()
|
bot.run()
|
||||||
except ServerDisconnectedError:
|
except ServerDisconnectedError:
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
print("connection lost, reconnecting in 5 seconds...")
|
logging.info("connection lost, reconnecting in 5 seconds...")
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print("exiting...")
|
logging.info("exiting...")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
Loading…
Reference in a new issue