README.md in sentry-raven-0.3.1 vs README.md in sentry-raven-0.4.0
- old
+ new
@@ -77,18 +77,62 @@
config.dsn = 'http://public:secret@example.com/project-id'
# manually configure environment if ENV['RACK_ENV'] is not defined
config.current_environment = 'production'
end
+```
-Raven.capture # Global style
+## Capturing Events
-Raven.capture do # Block style
+Many implementations will automatically capture uncaught exceptions (such as Rails, Sidekiq or by using
+the Rack middleware). Sometimes you may want to catch those exceptions, but still report on them.
+
+Several helps are available to assist with this.
+
+### Capture Exceptions in a Block
+
+```ruby
+Raven.capture do
+ # capture any exceptions which happen during execution of this block
1 / 0
end
```
+### Capture an Exception by Value
+
+```ruby
+begin
+ 1 / 0
+rescue ZeroDivisionError => exception
+ Raven.capture_exception(exception)
+end
+```
+
+### Additional Context
+
+Additional context can be passed to the capture methods.
+
+```ruby
+Raven.capture_message("My event", {
+ :logger => 'logger',
+ :extra => {
+ 'my_custom_variable' => 'value'
+ },
+ :tags => {
+ 'environment' => 'production',
+ }
+})
+```
+
+The following attributes are available:
+
+* `logger`: the logger name to record this event under
+* `level`: a string representing the level of this event (fatal, error, warning, info, debug)
+* `server_name`: the hostname of the server
+* `tags`: a mapping of tags describing this event
+* `extra`: a mapping of arbitrary context
+
## Testing
```bash
$ bundle install
$ rake spec
@@ -125,26 +169,34 @@
```
## Sanitizing Data (Processors)
If you need to sanitize or pre-process (before its sent to the server) data, you can do so using the Processors
-implementation. By default, a single processor is installed (Raven::Processors::SanitizeData), which will attempt to
+implementation. By default, a single processor is installed (Raven::Processor::SanitizeData), which will attempt to
sanitize keys that match various patterns (e.g. password) and values that resemble credit card numbers.
To specify your own (or to remove the defaults), simply pass them with your configuration:
```ruby
require 'raven'
Raven.configure do |config|
config.dsn = 'http://public:secret@example.com/project-id'
- config.processors = [Raven::Processors::SanitizeData]
+ config.processors = [Raven::Processor::SanitizeData]
end
+```
+## Command Line Interface
+
+Raven includes a basic CLI for testing your DSN:
+
+```ruby
+ruby -Ilib ./bin/raven test <DSN>
+```
+
Resources
---------
-* `Bug Tracker <http://github.com/getsentry/raven-ruby/issues>`_
-* `Code <http://github.com/getsentry/raven-ruby>`_
-* `Mailing List <https://groups.google.com/group/getsentry>`_
-* `IRC <irc://irc.freenode.net/sentry>`_ (irc.freenode.net, #sentry)
-
+* [Bug Tracker](http://github.com/getsentry/raven-ruby/issues>)
+* [Code](http://github.com/getsentry/raven-ruby>)
+* [Mailing List](https://groups.google.com/group/getsentry>)
+* [IRC](irc://irc.freenode.net/sentry>) (irc.freenode.net, #sentry)