Sha256: 00efc263c0fb6d46ac0be577b7ecae708cc5af865630477ee7ef983ab7b0d315

Contents?: true

Size: 784 Bytes

Versions: 2

Compression:

Stored size: 784 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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nadir-1.1.4 lib/nadir.rb
nadir-1.1.3 lib/nadir.rb