Giter Site home page Giter Site logo

failurous-ruby's Introduction

failurous-ruby

failurous-ruby is a Ruby client library used for sending fail notifications to Failurous (see http://github.com/mnylen/failurous).

Installation

With Bundler, add this to your Gemfile:

gem 'failurous-ruby', :git => 'git://github.com/mnylen/failurous-ruby.git'

Other ways: TBD after the gem is released

Configuration

To start using the client, it must be configured with the address and port of the Failurous server and the API key for the project it's used in.

This can be achieved by calling Failurous.configure:

require 'failurous'

Failurous.configure do |config|
  config.server_name = "failurous.mycompany.com"
  config.server_port = 443
  config.api_key     = "API KEY for your project"
end

You can also configure the following obligatory options:

  • use_ssl - set to true to encrypt notifications using SSL (defaults to false)
  • send_timeout - when Failurous server is slow to respond, this determines how long, in seconds, the notifier should wait before timing out (defaults to 2)
  • logger - in case the notifications could not be sent, the logger is used to log the reason (by default, no logger is used)
  • https_verify_mode - the verify mode to use when use_ssl is set to true (see Net::HTTP#verify_mode=, defaults to nil which uses the Net::HTTP defaults)
  • https_ca_file - the CA file to use when use_ssl is set to true (passed to Net::HTTPS#ca_file=, defaults to nil which uses the Net::HTTP defaults)

Usage

Fail notifications are sent using Failurous::FailNotifier.notify(notification). The notification can be created using Failurous::FailNotification class.

Basic usage example:

def somemethod
  some
  failing
  code
rescue => ex
  Failurous::FailNotifier.notify(Failurous::FailNotification.new("#{ex.class} in somemethod", ex).
    add_field(:section, :field_name, "field value", { :use_in_checksum => false, :humanize_field_name => true }))
end

For full syntax for building notifications, see the documentation for FailNotification

Shorthands exists for sending notifications of exceptions:

def somemethod
  some
  failing
  code
rescue => ex
  Failurous.notify(ex)
  # or Failurous.notify("My custom message", ex)
  # or just Failurous.notify("My message")
end

Support & Bug Reports

#failurous @ FreeNode

Failurous Lighthouse

License

Copyright (c) 2010 Mikko Nylén, Tero Parviainen & Antti Forsell

See LICENSE

failurous-ruby's People

Contributors

mnylen avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.