Add user id to sentry logs
This commit is contained in:
parent
bfc2ccdf8e
commit
8189e05b0d
|
|
@ -318,6 +318,23 @@ LOGGING = {
|
|||
}
|
||||
}
|
||||
|
||||
if not DEBUG and os.environ.get('SENTRY_DSN'):
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
|
||||
def before_send(event, hint):
|
||||
user = event['user']
|
||||
id = user['id']
|
||||
event['user'] = {'id': id}
|
||||
return event
|
||||
|
||||
sentry_sdk.init(
|
||||
dsn=os.environ.get('SENTRY_DSN'),
|
||||
integrations=[DjangoIntegration()],
|
||||
send_default_pii=True,
|
||||
before_send=before_send
|
||||
)
|
||||
|
||||
if not DEBUG and os.environ.get('SENTRY_DSN'):
|
||||
import sentry_sdk
|
||||
from sentry_sdk.integrations.django import DjangoIntegration
|
||||
|
|
|
|||
Loading…
Reference in New Issue