crystal-rollbar
An unofficial Crystal-language client and integration layer for the Rollbar error reporting API.
Based on Rollbar-gem and raven.cr
Features:
- report to Rollbar
- report about parent exception
- Kemal integration. Sumbit URL, HTTP variable based on Kemal environment
- Write example of async error reporting (fiber, sidekiq)
Installation
-
Add the dependency to your
shard.yml
:dependencies: crystal-rollbar: github: msa7/crystal-rollbar
-
Run
shards install
Usage
require "crystal-rollbar"
Rollbar.access_token = "rollbar_access_token"
Rollbar.environment = "staging"
Rollbar.framework = "Kemal"
Rollbar.code_version = "0.1"
Rollbar.debug("Debug #{Time.utc}", user_id = "777")
begin
raise "Error #{Time.utc}"
rescue e
Rollbar.error(e, user_id = "555")
end
With Kemal
require "crystal-rollbar/kemal"
Kemal.config.add_handler(Rollbar::Kemal::ExceptionHandler.new)
Kemal.run
With Sidekiq
require "crystal-rollbar/sidekiq"
cli = Sidekiq::CLI.new
server = cli.configure do |config|
config.error_handlers << Rollbar::Sidekiq::ExceptionHandler.new
end
cli.run(server)
Contributing
- Fork it (https://github.com/your-github-user/crystal-rollbar/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
Contributors
- Sergey Makridenkov - creator and maintainer