Sha256: b5059db062a4bdb1c795d4d042839c576f6d40a83a1ae74f23541eb696bb3c1c

Contents?: true

Size: 738 Bytes

Versions: 6

Compression:

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nadir-1.1.2 lib/nadir.rb
nadir-1.1.1 lib/nadir.rb
nadir-1.1.0 lib/nadir.rb
nadir-1.0.2 lib/nadir.rb
nadir-1.0.1 lib/nadir.rb
nadir-1.0.0 lib/nadir.rb