Sentinel

This is a gem for ErrorReportApi server integration.

Installation

Add this line to your application's Gemfile:

gem 'sentinel_api'

And then execute:

$ bundle

Or install it yourself as:

$ gem install sentinel_api

Add initializer file

$ rails g sentinel_api:install

Don't forget to configure your ErrorReporterAPI server uri and method

Usage

There are 3 methods, which produce 3 log level messages: info, warn, error.

You can use this gem in 3 ways:

  • provide hash with 3 keys: message, info, tags
  • provide message, exception and tags - info would be made from exception's class message and backtrace
  • provide message and exception - no tags would be sent
  • provide only exception, exception message would be used, no tags ruby SentinelApi.info({ message: 'your custom error message', info: 'system info or other information', tags: ['tag1', 'tag2']}) SentinelApi.warn('your message', exception, ['tag1', 'tag2']) SentinelApi.error('your message', exception)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Configuration

  • Add the following environment variables:

    • ENV['SENTINEL_API_URI'] : The error reporter uri to receive the request params. Default is 'http://localhost:3000/reports'.
    • ENV['SENTINEL_API_METHOD'] : The api method to be used to communicate with the url. Default is 'post'.