Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(python): Add custom_repr docs #11059

Merged
merged 4 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion docs/platforms/python/configuration/options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ When set to `False`, no auto-enabling integrations will be enabled by default, e

Configures whether [default integrations](/platforms/python/integrations/default-integrations/) should be enabled. The default is `True`.

Setting `default_integrations` to `False` disables all default integrations **as well as all auto-enabling integrations**, unless they are specifically added in the `integrations` option, described above.
Setting `default_integrations` to `False` disables all default integrations **as well as all auto-enabling integrations**, unless they are specifically added in the `integrations` option, described above.


## Hooks
Expand Down Expand Up @@ -386,3 +386,23 @@ The threshold in milliseconds for adding the source location to database queries
Default is `100` ms.

</ConfigKey>

<ConfigKey name="custom-repr">

A custom [repr](https://docs.python.org/3/library/functions.html#repr) function to run while serializing an object. Use this to control how your custom objects and classes are visible in Sentry.

Return a string for that repr value to be used or `None` to continue serializing how Sentry would have done it anyway.

```python
def custom_repr(obj):
if isinstance(obj, MyCustomClass):
return "<MyCustomClass>"
else
return None

sentry_sdk.init(custom_repr=custom_repr)
```

Default is `None`.

</ConfigKey>
Loading