[Flask] insert current_user value into logger generated emails?

Corey Boyle coreybrett at gmail.com
Thu Jul 1 08:54:32 EDT 2021


I have the following code in my app factory...

    mh = SMTPHandler(
        mailhost=app.config["MAIL_SERVER"],
        fromaddr=app.config["MAIL_DEFAULT_SENDER"],
        toaddrs=app.config["ERRORS_EMAIL"],
        subject="Error",
    )
    mh.setLevel(logging.ERROR)
    app.logger.addHandler(mh)

Is there any way to get the value of "current_user" inserted into the email
somewhere?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/flask/attachments/20210701/54942f82/attachment.html>


More information about the Flask mailing list