Skip to content

Conversation

mhib
Copy link
Contributor

@mhib mhib commented Jul 20, 2023

Motivation / Background

Currently on every call to ActionCable::Channel::Base#transmit, debug log message is generated that inspects the provided data object. The message is generated even if the logger's level is above WARN. This patch makes it so the message is generated only when it can be logged.

Detail

In a very similar scenario in ActionCable::Server::Broadcasting::Broadcaster#broadcast debug method with a block is used. To use the same call in ActionCable::Channel::Base#transmit, TaggedLoggerProxy must pass block to the wrapped logger.

Additional information

Checklist

Before submitting the PR make sure the following are checked:

  • [*] This Pull Request is related to one change. Changes that are unrelated should be opened in separate PRs.
  • [*] Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • [*] Tests are added or updated if you fix a bug or add a feature.
  • [*] CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

@matthewd matthewd merged commit ea9b647 into rails:main Jul 21, 2023
@matthewd
Copy link
Member

Sounds reasonable, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants