Project

flub

0.0
No commit activity in last 3 years
No release in over 3 years
A gem to centralize error logging to external services (New Relic, Airbrake etc)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.5
>= 0
>= 0
 Project Readme

Flub

Simple error recipient for centralizing error logging in an app.

No more of those pesky NewRelic::Agent.notice_error everywhere, only Flub.register_exception

Installation

Add this line to your application's Gemfile:

gem 'flub'

And then execute:

$ bundle

Or install it yourself as:

$ gem install flub

Usage

# config/initializers/flub.rb

logger Rails.logger # optional, default is a NullLogger

Flub.configure do
  on_error do |e, data, log_level|
    Rollbar.report_exception(e, nil, data, log_level)
  end

  on_error do |e, data, log_level|
    NewRelic::Agent.notice_error(e, custom_params: data)
  end
end

# somewhere else
Flub.register_exception(ActiveRecord::RecordNotFound.new, {current_user: 123}, :warn)

This will notify both Rollbar and New Relic about the error.

Each block provided to on_error is executed in it's own begin/rescue, logging any failures to the provided logger.

Contributing

  1. Fork it ( http://github.com//flub/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request