Sha256: e39fe010502cbce8c617543efe30f1594a3173711812233c852ae19c1b4db944

Contents?: true

Size: 797 Bytes

Versions: 6

Compression:

Stored size: 797 Bytes

Contents

require 'nadir/config'
require 'nadir/middleware/rack'
require 'nadir/notification'
require 'nadir/transport/http_async'
require 'nadir/version'

module Nadir
  extend self

  def config
    @config ||= Config.new
  end

  def configure
    yield config if block_given?
  end

  def logger
    config.logger
  end

  def notify(exception, params = {})
    return false unless config.validate

    notification = Notification.new exception, params

    transport.deliver notification.to_params

    true
  rescue => e
    logger.error "[Nadir] Internal error: #{e.inspect}"

    false
  end

  private

  def transport
    @_transport ||= Nadir::Transport::HTTPAsync.new
  end
end

require 'nadir/plugins/rails' if defined? Rails::Railtie
require 'nadir/plugins/rake' if defined? Rake::Application

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nadir-1.1.10 lib/nadir.rb
nadir-1.1.9 lib/nadir.rb
nadir-1.1.8 lib/nadir.rb
nadir-1.1.7 lib/nadir.rb
nadir-1.1.6 lib/nadir.rb
nadir-1.1.5 lib/nadir.rb