Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 6 additions & 3 deletions lib/rollbar/notifier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,12 @@ def log_instance_link(data)
return unless data[:uuid]

uuid_url = Util.uuid_rollbar_url(data, configuration)
log_info(
"[Rollbar] Details: #{uuid_url} (only available if report was successful)"
)
info_message = "[Rollbar] Details: #{uuid_url} (only available if report was successful)"
if configuration.async_handler
async_handler = configuration.async_handler.class == Class ? configuration.async_handler : configuration.async_handler.class
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if async_handler is a Proc, then it will print Proc

info_message += ". With async handler = #{async_handler}"
end
log_info(info_message)
end

def via_failsafe?(item)
Expand Down
40 changes: 40 additions & 0 deletions spec/rollbar_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1798,6 +1798,16 @@ def backtrace
Rollbar.configure(&:use_sucker_punch)
Rollbar.error(exception)
end

it "shows 'Rollbar::Delay::SuckerPunch' on the log" do
Rollbar.configure do |config|
config.use_sucker_punch
config.transmit = false
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put transmit = false to skip Scheduled log

is it ok?

end

expect(Rollbar.notifier).to receive(:log_info).with(/With async handler = Rollbar::Delay::SuckerPunch/)
Rollbar.notifier.info('info', 'foo bar')
end
end

describe '#use_shoryuken', :if => defined?(Shoryuken) do
Expand All @@ -1808,6 +1818,16 @@ def backtrace
Rollbar.configure(&:use_shoryuken)
Rollbar.error(exception)
end

it "shows 'Rollbar::Delay::Shoryuken' on the log" do
Rollbar.configure do |config|
config.use_shoryuken
config.transmit = false
end

expect(Rollbar.notifier).to receive(:log_info).with(/With async handler = Rollbar::Delay::Shoryuken/)
Rollbar.notifier.info('info', 'foo bar')
end
end

describe '#use_sidekiq', :if => defined?(Sidekiq) do
Expand All @@ -1828,6 +1848,16 @@ def backtrace

Rollbar.error(exception)
end

it "shows 'Rollbar::Delay::Sidekiq' on the log" do
Rollbar.configure do |config|
config.use_sidekiq
config.transmit = false
end

expect(Rollbar.notifier).to receive(:log_info).with(/With async handler = Rollbar::Delay::Sidekiq/)
Rollbar.notifier.info('info', 'foo bar')
end
end

describe '#use_thread' do
Expand Down Expand Up @@ -1863,6 +1893,16 @@ def backtrace
expect(thread.priority).to eq(custom_priority)
thread.join
end

it "shows 'Rollbar::Delay::Thread' on the log" do
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that ActiveJob test does not exist on rollbar_spec
but it shouldn't be a problem I think

Rollbar.configure do |config|
config.use_thread
config.transmit = false
end

expect(Rollbar.notifier).to receive(:log_info).with(/With async handler = Rollbar::Delay::Thread/)
Rollbar.notifier.info('info', 'foo bar')
end
end
end

Expand Down