Skip to content

Commit

Permalink
Remove [Listen warning] prefix from warning message
Browse files Browse the repository at this point in the history
Since Listen.logger.warn formats the error message with a `WARN -- : #{msg}`
we don't need the [Listen warning] part as it is redundant
  • Loading branch information
AlexB52 committed Nov 29, 2023
1 parent bd460ab commit f1e8098
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/listen/adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _usable_adapter_class

def _warn_polling_fallback(options)
msg = options.fetch(:polling_fallback_message, POLLING_FALLBACK_MESSAGE)
Listen.logger.warn "[Listen warning]:\n #{msg}" if msg
Listen.logger.warn(msg) if msg
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions spec/lib/listen/adapter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

it 'warns polling fallback with default message' do
msg = described_class::POLLING_FALLBACK_MESSAGE
expect(Listen.logger).to receive(:warn).with("[Listen warning]:\n #{msg}")
expect(Listen.logger).to receive(:warn).with(msg)
Listen::Adapter.select
end

Expand All @@ -59,7 +59,7 @@
end

it 'warns polling fallback with custom message if set' do
expected_msg = "[Listen warning]:\n custom fallback message"
expected_msg = "custom fallback message"
expect(Listen.logger).to receive(:warn).with(expected_msg)
msg = 'custom fallback message'
Listen::Adapter.select(polling_fallback_message: msg)
Expand Down

0 comments on commit f1e8098

Please sign in to comment.