You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Just a suggestion: would it be possible to add a "reduced" DEBUG_API_REQUESTS implementation to log only basic information about the requests and responses (eg. status code, possibly errors in the response; a subset of fields in the request) to allow use outside dev environments?
I'm asking because we had an impossible to track intermittent problem with some notifications (ESP is Postmark) - all our logs confirmed that the email was sent, but nothing was apparently received by Postmark, and Anymail showed no error.
The text was updated successfully, but these errors were encountered:
Long-term I'm thinking Anymail should really embrace the Python logging facility, replacing DEBUG_API_REQUESTS. So log.info every send, with the sort of minimal info you describe. And log.debug the full request/response (what DEBUG_API_REQUESTS does now). Probably log webhooks the same way. Maybe even log.warning any errors ignored by Django's fail_silently send option.
And then the standard Django LOGGING settings would control it all, allowing users to change the log level for the anymail module (or even individual ESP backends, I guess).
Short-term, for requests-based backends (all but Amazon SES), you could use the new requests session customization hook that will be in Anymail 9.0 to add your own logging of anything you want:
deflog_response(response):
# do any logging you want here...# response is a requests.Responserequest=response.request# request is a requests.PreparedRequestprint(request.url, response.status_code)
classMyDebugPostmarkBackend(anymail.backends.postmark.EmailBackend):
defcreate_session(self):
session=super().create_session()
session.hooks['response'].append(log_response)
returnsession
(And then in settings.py, set EMAIL_BACKEND = 'path.to.your.MyDebugPostmarkBackend'.
Just a suggestion: would it be possible to add a "reduced" DEBUG_API_REQUESTS implementation to log only basic information about the requests and responses (eg. status code, possibly errors in the response; a subset of fields in the request) to allow use outside dev environments?
I'm asking because we had an impossible to track intermittent problem with some notifications (ESP is Postmark) - all our logs confirmed that the email was sent, but nothing was apparently received by Postmark, and Anymail showed no error.
The text was updated successfully, but these errors were encountered: