python 3.5
sentry-sdk 0.8.0
Hello,
I’m trying to get in Sentry.io some informations (INFO level) coming from a view in Django and I’m not sure to understand how to make it. This is what I have tried :
In settings.py
sentry_logging = LoggingIntegration(
level=logging.INFO,
event_level=logging.INFO
)
sentry_sdk.init(
dsn="https://###",
integrations=[DjangoIntegration(), sentry_logging],
server_name="MyServerName",
)
In views.py
def myview(request, something):
# Here I do something
# Log some data
logger.info('Interesting info !', extra={
'something_modified': something_modified,
})
With this code, I don’t see my event info in Sentry. If I call logger.error(###) it shows this event and I have the red “error” flag, like expected with error level.
So I tried :
def myview(request, something):
# Here I do something
# Log some data
with configure_scope() as scope:
scope.level = 'info'
logger.info('Interesting info !', extra={
'something_modified': something_modified,
})
- It doesn’t work either
- With logger.error(###) it shows this event and I have a blue info flag in Sentry
- But the other real errors now appear in blue too, which is a bit too monochrome
Some concepts from the documentation are still unclear for me, I may have mixed “context / scope / levels” together.
Thanks for your help.