Skip to content

Instantly share code, notes, and snippets.

@bruno-garcia
Last active July 3, 2019 15:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bruno-garcia/72fea0440b020831f4b084666494e79c to your computer and use it in GitHub Desktop.
Save bruno-garcia/72fea0440b020831f4b084666494e79c to your computer and use it in GitHub Desktop.
// Modifying root scope
Sentry.setTag("a","a");
// Creates a new scope and pushes in the stap, a clone of the previous one.
Sentry.pushScope();
// Here we have a tag a with value a
Sentry.setTag("a","b");
// Now a has value b
// Throw away the current scope (goes back to the previous item in the stack)
Sentry.popScope();
// Now tag a has value a
// withScope is just a short cut:
// Modifying root scope
Sentry.setTag("a","a");
Sentry.withScope(s => {
// Here we have a tag a with value a
s.setTag("a","b");
// Now a has value b
})
// Throw away the current scope (goes back to the previous item in the stack)
// Now tag a has value a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment