Skip to content

Commit 74143e8

Browse files
committed
Add beforeBreadcrumb hook description
1 parent bf39891 commit 74143e8

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

docs/platforms/unreal/configuration/options.mdx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,19 @@ By the time <PlatformIdentifier name="before-send" /> is executed, all scope dat
103103

104104
</ConfigKey>
105105

106+
<ConfigKey name="before-breadcrumb">
107+
108+
This function is called with an SDK-specific breadcrumb object before the breadcrumb is added to the scope. When nothing is returned from the function, the breadcrumb is dropped. To pass the breadcrumb through, return the first argument, which contains the breadcrumb object.
109+
The callback typically gets a second argument (called a "hint") which contains the original object from which the breadcrumb was created to further customize what the breadcrumb should look like.
110+
111+
<Alert>
112+
113+
Currently, hints are supported only on Android.
114+
115+
</Alert>
116+
117+
</ConfigKey>
118+
106119
## Tracing Options
107120

108121
<ConfigKey name="traces-sample-rate">

docs/platforms/unreal/enriching-events/breadcrumbs/index.mdx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,29 @@ The same result can be achieved by calling corresponding function in blueprint:
3737
The Unreal Engine SDK can capture certain types of breadcrumbs automatically. Those can be enabled using the Sentry configuration window at **Project Settings > Plugins > Sentry**.
3838
3939
![Sentry automatic breadcrumbs](./img/unreal_automatic_breadcrumbs.png)
40+
41+
## Customize Breadcrumbs
42+
43+
SDKs allow you to customize breadcrumbs through the <PlatformIdentifier name="before-breadcrumb" /> hook (the corresponding handler class can be set in the plugin settings).
44+
45+
This hook is passed an already assembled breadcrumb and, in some SDKs, an optional hint. The function can modify the breadcrumb or decide to discard it entirely by returning `nullptr`:
46+
47+
```cpp
48+
UCLASS()
49+
class UCustomBeforeBreadcrumbHandler : public USentryBeforeBreadcrumbHandler
50+
{
51+
GENERATED_BODY()
52+
53+
public:
54+
virtual USentryBreadcrumb* HandleBeforeBreadcrumb_Implementation(USentryBreadcrumb* Breadcrumb, USentryHint* Hint)
55+
{
56+
if (Breadcrumb->GetCategory() == "Spammy.Logger")
57+
{
58+
// Discard breadcrumb
59+
return nullptr;
60+
}
61+
62+
return Breadcrumb;
63+
}
64+
};
65+
```

0 commit comments

Comments
 (0)