Skip to content

ActionReporter as a ruby wrapper for multiple reporting services for exceptions, notifications and context reporting

License

Notifications You must be signed in to change notification settings

amkisko/action_reporter.rb

Repository files navigation

action_reporter

Gem Version Test Status codecov

Codacy Badge Codacy Badge

Ruby wrapper for multiple reporting services.

Supported services:

  • Rails logger
  • Audited
  • PaperTrail
  • Sentry
  • Honeybadger
  • scoutapm

Sponsored by Kisko Labs.

Install

Using Bundler:

bundle add action_reporter

Using RubyGems:

gem install action_reporter

Gemfile

gem 'action_reporter'

Usage

Put this in your config/initializers/action_reporter.rb file:

ActionReporter.enabled_reporters = [
  ActionReporter::RailsReporter.new,
  # ActionReporter::AuditedReporter.new,
  # ActionReporter::PaperTrailReporter.new,
  # ActionReporter::SentryReporter.new,
  # ActionReporter::HoneybadgerReporter.new,
  # ActionReporter::ScoutApmReporter.new
]

Then you can use it in your code:

ActionReporter.current_user = current_user
ActionReporter.current_request_uuid = request.env['action_dispatch.request_id']
ActionReporter.current_remote_addr = request.env['action_dispatch.remote_ip']
ActionReporter.context(entry_id: entry.id)
ActionReporter.notify('Something went wrong', context: { record: record })

Hook debugger to notify method

Apply patch on initializer level or before running the main code:

module ActionReporter
  class RailsReporter < Base
    def notify(error, context: {})
      super
      binding.pry
    end
  end
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/amkisko/action_reporter.rb

Contribution policy:

  • It might take up to 2 calendar weeks to review and merge critical fixes
  • It might take up to 6 calendar months to review and merge pull request
  • It might take up to 1 calendar year to review an issue
  • New integrations and third-party features are not nessessarily added to the gem
  • Pull request should have test coverage for affected parts
  • Pull request should have changelog entry

Publishing

rm action_reporter-*.gem
gem build action_reporter.gemspec
gem push action_reporter-*.gem

License

The gem is available as open source under the terms of the MIT License.

About

ActionReporter as a ruby wrapper for multiple reporting services for exceptions, notifications and context reporting

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published