bugsnag

Version, currently master branch1 version
  • master branchlatestFeb 8, 2023

github.com/gewo/bugsnag.cr

bugsnag exception notifier written in crystal. Supports sidekiq.cr, kemal, HTTP::Server.

7 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  bugsnag:
    github: gewo/bugsnag.cr
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
0.23.1
License
MIT
Author
Gebhard Woestemeyer <g@ctr.lc>
Target
  • bugsnag from src/bugsnag.cr

Dependencies

Development Dependencies

  • sidekiq*git: https://github.com/mperham/sidekiq.cr, branch: masterdev
  • webmock*git: https://github.com/manastech/webmock.cr, branch: masterdev

README

# bugsnag.cr

[![Build
Status](https://travis-ci.org/gewo/bugsnag.cr.svg)](https://travis-ci.org/gewo/bugsnag.cr/)

[bugsnag][] exception notifier written in [crystal][]. Supports
[sidekiq.cr][], [kemal][], HTTP::Server.

[bugsnag.cr][] is heavily inspired by (read: stolen)
[airbrake-crystal][]. Thanks.

## Usage

Reporting handled exceptions:

    require "bugsnag"

    begin
      raise "Something went wrong!"
    rescue => exception
      Bugsnag.notify(exception)
    end

### sidekiq

    require "bugsnag"
    require "bugsnag/sidekiq"

    cli = Sidekiq::CLI.new
    server = cli.configure do |config|
      config.server_middleware.add Bugsnag::Sidekiq.new
    end

### HTTP::Server

    require "http/server"
    require "bugsnag"
    require "bugsnag/http_handler"

    server = HTTP::Server.new("0.0.0.0", 1337,
      [
        Bugsnag::HttpHandler.new
      ]) do |context|
        raise "narf"
    end

    server.listen

### Kemal

    require "kemal"
    require "bugsnag"
    require "bugsnag/http_handler"

    add_handler Bugsnag::HttpHandler.new

    get "/" do |env|
      raise "narf"
    end

    Kemal.run

## Configuration

    require "bugsnag"

    Bugsnag.configure do |config|
      config.api_key = "YOUR_API_KEY_HERE"
    end

## Installation

Add [bugsnag.cr][bugsnag.cr] as a dependency in `shards.yml`

    dependencies:
      bugsnag:
        github: gewo/bugsnag.cr

Run `shards update` to download.

[bugsnag.cr]: https://github.com/gewo/bugsnag.cr/
[bugsnag]: https://bugsnag.com/
[crystal]: https://crystal-lang.org/
[kemal]: http://kemalcr.com
[sidekiq.cr]: https://github.com/mperham/sidekiq.cr/
[airbrake-crystal]: https://github.com/kyrylo/airbrake-crystal/