I am hoping to dynamically add loggers to a file whenever I decide to ignore a certain logger from sending to sentry, I've read the docs and this answer How to ignore a logger in the Sentry Python SDK and I believe I got it working when I has put the literal string into the ignore_logger function.
When I try the below code, it doesn't ignore the logger, is there a better way to achieve this?
with suppress(FileNotFoundError):
with open(os.path.join(SITE_ROOT, '..', 'sentry_ignore_logger.txt')) as f:
for log_line in f:
ignore_logger(log_line)
I had a print statement inside the loop to check it was reading the file and it printed as desired, so the issue isn't an incorrect file. The contents of the file are:
django.security.DisallowedHost
I'm using Djano and I've put this in my settings.py after the sentry_sdk.init (I had it before it, however that also didn't work)
Thanks