Skip to content

Commit

Permalink
Add documentation for Rollbar::Logger
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon de Andres committed Apr 5, 2016
1 parent 1e63de2 commit bffaf7d
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ Rollbar.silenced {
}
```

# Sending backtrace without rescued exceptions
## Sending backtrace without rescued exceptions

If you use the gem in this way:

Expand Down Expand Up @@ -698,6 +698,25 @@ config.failover_handlers = [Rollbar::Delay::GirlFriday, Rollbar::Delay::Thread]

With the configuration above Resque will be your primary asynchronous handler but if it fails queueing the job Rollbar will use GirlFriday at first, and just a thread in case that GirlFriday fails too.

## Logger interface

The gem provides a class `Rollbar::Logger` that inherits from `Logger` so you can use Rollbar to log your application messages. The basic usage is:

```ruby
require 'rollbar/logger'

logger = Rollbar::Logger.new
logger.info('Purchase failed!')
```

If you are using Rails you can extend your `Rails.logger` so the log messages are sent to both outputs. You can use this snippet in one initializer:

```ruby
require 'rollbar/logger'

Rails.logger.extend(ActiveSupport::Logger.broadcast(Rollbar::Logger.new))
```

## Using with rollbar-agent

For even more asynchrony, you can configure the gem to write to a file instead of sending the payload to Rollbar servers directly. [rollbar-agent](https://github.com/rollbar/rollbar-agent) can then be hooked up to this file to actually send the payload across. To enable, add the following in ```config/initializers/rollbar.rb```:
Expand Down

0 comments on commit bffaf7d

Please sign in to comment.