Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ The Native SDK maintains all data in a single global scope.

sentry_set_tag("my-tag", "my value");

sentry_value_t user = sentry_value_new_object();
sentry_value_set_by_key(user, "id", sentry_value_new_int32(42));
sentry_value_set_by_key(user, "email", sentry_value_new_string("john.doe@example.com"));
// Set a user with id, username, email, and ip_address
sentry_value_t user = sentry_value_new_user("42", "Jane Doe", "jane.doe@example.com", "{{auto}}");
sentry_set_user(user);
```
7 changes: 4 additions & 3 deletions platform-includes/enriching-events/set-user/native.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
```c
#include <sentry.h>

sentry_value_t user = sentry_value_new_object();
sentry_value_set_by_key(user, "ip_address", sentry_value_new_string("{{auto}}"));
sentry_value_set_by_key(user, "email", sentry_value_new_string("jane.doe@example.com"));
// Set a user with id, username, email, and ip_address
sentry_value_t user = sentry_value_new_user("42", "Jane Doe", "jane.doe@example.com", "{{auto}}");
// Set additional custom user data
sentry_value_set_by_key(user, "custom_key", sentry_value_new_string("custom_value"));
sentry_set_user(user);
```

Expand Down
9 changes: 3 additions & 6 deletions platform-includes/sensitive-data/set-user/native.mdx
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
The Native SDK maintains all data in a single global scope.

```c
#include <sentry.h>

sentry_value_t user = sentry_value_new_object();
sentry_value_set_by_key(user, "id", sentry_value_new_int32(client_user->id));
// OR
sentry_value_set_by_key(user, "username", sentry_value_new_string(client_user->username));
// At least one parameter must be non-NULL. In this case, the user value will only
// contain the id. username, email, and ip_address will be ignored.
sentry_value_t user = sentry_value_new_user("42", NULL, NULL, NULL);
sentry_set_user(user);
```