Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Conversation

@dcramer
Copy link
Member

@dcramer dcramer commented Dec 3, 2013

This makes the API much easier to use, and resembles the raven-ruby implementation. Users can continually merge context (generally within their middleware), and simply need to call context.clear() to refresh it.

The following APIs are added as part of this changeset:

Client.context -- the accessible context instance
>>> Client.context.get()

Client.context.clear() -- flush the current context
>>> Client.context.clear()

Client.user_context() -- a shortcut to set the user interface
>>> Client.user_context({'email': 'foo@example.com'})

Client.tags_context() -- add additional tags to context (or overwrite an existing tag)
>>> Client.tags_context({'key': 'value'})

Client.extra_context() -- add additional data to context (or overwrite an existing key in the data)
>>> Client.extra_context({'key': 'value'})

This makes the API much easier to use, and resembles the raven-ruby implementation. Users can continually merge context (generally within their middleware), and simply need to call context.clear() to refresh it.

The following APIs are added as part of this changeset:

```
Client.context -- the accessible context instance
>>> Client.context.get()

Client.context.clear() -- flush the current context
>>> Client.context.clear()

Client.user_context() -- a shortcut to set the user interface
>>> Client.user_context({'email': 'foo@example.com'})

Client.tags_context() -- add additional tags to context (or overwrite an existing tag)
>>> Client.tags_context({'key': 'value'})

Client.extra_context() -- add additional data to context (or overwrite an existing key in the data)
>>> Client.extra_context({'key': 'value'})
```
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.12%) when pulling 6f03dee on rewrite-context into 0ace37b on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.12%) when pulling 6f03dee on rewrite-context into 0ace37b on master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.12%) when pulling 6f03dee on rewrite-context into 0ace37b on master.

dcramer added a commit that referenced this pull request Dec 4, 2013
@dcramer dcramer merged commit 04b8cd7 into master Dec 4, 2013
@dcramer dcramer deleted the rewrite-context branch December 4, 2013 08:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants