class Bugsnag::Delivery::Fluent

Constants

VERSION

Public Class Methods

deliver(url, body, configuration, options = {}) click to toggle source
# File lib/bugsnag/delivery/fluent.rb, line 26
def self.deliver(url, body, configuration, options = {})
  logger = nil
  begin
    logger = ::Fluent::Logger::FluentLogger.new(
      configuration.fluent_tag_prefix,
      :host => configuration.fluent_host,
      :port => configuration.fluent_port
    )
    if logger.post('deliver', { :url => url, :body => body, :options => options })
      configuration.debug("Notification to #{url} finished, payload was #{body}")
    else
      configuration.warn("Notification to #{url} failed, #{logger.last_error}")
    end
  rescue StandardError => e
    raise if e.class.to_s == "RSpec::Expectations::ExpectationNotMetError"

    configuration.warn("Notification to #{url} failed, #{e.inspect}")
    configuration.warn(e.backtrace)
  ensure
    logger.close if logger
  end
end