This is a notification gem for Trackets.com. It catches all unhandled exceptions and sends them to the Trackets servers.
Add this line to your application's Gemfile:
gem "trackets", "~> 0.0.9"
And then execute:
$ bundle
In order to setup Trackets for Ruby, you need to first find your API key. To do this simply open up your project on Trackets, go to settings and copy the API key.
$ rails g trackets:install PUBLIC_KEY PRIVATE_KEY
$ rake trackets:test # To send testing exception
If you wish to enable JavaScript error tracking, you can do so using a
helper which this gem provides. Simply include the following snippet in
your app/views/layout/application.html.erb
in the <head>
tag
directly above your application JavaScript.
<head>
<%= trackets_include_tag %>
<!-- The rest of your JavaScript goes below -->
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
...
</head>
Can be found in config/initializers/trackets.rb
Trackets.setup do |config|
config.public_api_key = "ebf6d706b29ca4e176012a3dc3b017a8" # Public API key used by JavaScript for your project
config.private_api_key = "77773de2325364bcc1d955e7aa3e7e1f" # Private API key used for Ruby notifications
config.async = true # [Default: false] Send notification in a separate thread (Uses Sucker Punch gem)
end
Here's a sample config.ru
require 'rack'
require 'trackets'
Trackets.setup do |config|
config.private_api_key = "insert-valid-api-key"
end
app = Rack::Builder.app do
run lambda { |env| raise "Testing Error" }
end
use Trackets::Middleware::RackExceptionHandler
run app
Currently there is only one rake task for testing the setup by sending
an exception to Trackets. You can do this simply by invoking rake trackets:notify
in your application after you've installed the gem.
$ rake trackets:notify MESSAGE="Custom message from Rake"
- Fork it ( https://github.com/[my-github-username]/trackets/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request