Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugsnag 6.x #2

Merged
merged 4 commits into from
Jan 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bugsnag-delivery-fluent.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rspec'
spec.add_development_dependency 'rspec-mocks'

spec.add_runtime_dependency 'bugsnag', "~> 5.0"
spec.add_runtime_dependency 'bugsnag', '~> 6.0'
spec.add_runtime_dependency 'fluent-logger'
end
10 changes: 5 additions & 5 deletions lib/bugsnag/delivery/fluent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,23 @@ class Configuration

module Delivery
class Fluent
def self.deliver(url, body, configuration)
def self.deliver(url, body, configuration, options = {})
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 })
Bugsnag.debug("Notification to #{url} finished, payload was #{body}")
configuration.debug("Notification to #{url} finished, payload was #{body}")
else
Bugsnag.warn("Notification to #{url} failed, #{logger.last_error}")
configuration.warn("Notification to #{url} failed, #{logger.last_error}")
end
rescue StandardError => e
raise if e.class.to_s == "RSpec::Expectations::ExpectationNotMetError"

Bugsnag.warn("Notification to #{url} failed, #{e.inspect}")
Bugsnag.warn(e.backtrace)
configuration.warn("Notification to #{url} failed, #{e.inspect}")
configuration.warn(e.backtrace)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bugsnag/delivery/fluent/version.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Bugsnag
module Delivery
class Fluent
VERSION = "0.1.4"
VERSION = "0.2.0"
end
end
end
8 changes: 4 additions & 4 deletions spec/bugsnag/delivery/fluent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
expect(::Fluent::Logger::FluentLogger).to receive(:new).and_return(fluent_logger)
end

subject { described_class.deliver(url, body, configuration) }
subject { described_class.deliver(url, body, configuration, {}) }

context 'send successful' do
before do
Expand All @@ -29,7 +29,7 @@

it do
expect(fluent_logger).to_not receive(:last_error)
expect(Bugsnag).to_not receive(:warn)
expect(configuration).to_not receive(:warn)
subject
end
end
Expand All @@ -42,7 +42,7 @@

it do
expect(fluent_logger).to receive(:last_error).and_return('LAST ERROR')
expect(Bugsnag).to receive(:warn).with('Notification to http://www.example.com/ failed, LAST ERROR')
expect(configuration).to receive(:warn).with('Notification to http://www.example.com/ failed, LAST ERROR')
subject
end
end
Expand All @@ -54,7 +54,7 @@

it do
expect(fluent_logger).to_not receive(:last_error)
expect(Bugsnag).to receive(:warn).exactly(2).times
expect(configuration).to receive(:warn).exactly(2).times
subject
end
end
Expand Down