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

Add support for Action Cable #257

Merged
merged 1 commit into from Apr 13, 2019

Conversation

Projects
None yet
3 participants
@xlts
Copy link
Contributor

commented Aug 28, 2018

Refactor log subscribers & create a new one to support logging of Action Cable events

Monkey-patch Action Cable server class to silence default Action Cable logger

Monkey-patch Action Cable Channel and Connection classes to support logging subscribe, unsubscribe, connect & disconnect events

Update log formatters to support Action Cable log data

@xlts

This comment has been minimized.

Copy link
Contributor Author

commented Aug 28, 2018

Two important remarks here:

  1. I decided to silence the default Action Cable logger (defined in ActionCable::Server::Base) completely - the framework code is littered with multiple logger calls in plenty of classes. Monkey-patching it would be utterly painful and could leave the code extremely hard to maintain in case of a change in Action Cable itself. As a consequence, calling logger e.g. in user-defined Connection or Channel classes has no effect - a Rails.logger has to be used instead. Should this solution be accepted, we'd probably need to include a post-install message informing the developer about this state of things.

  2. Obviously Action Cable doesn't include a notion of a "controller", however for simplicity I decided to use this name to indicate both Channel or Connection classes in formatters. So if e.g. a pong action defined in MyChannel < ActionCable::Channel::Base is called, the Graylog log message would include the following: MyChannel#pong and the key of MyChannel value in Lograge data hash is still called controller.

Add support for Action Cable
Refactor log subscribers & create a new one to support logging of Action Cable events

Monkey-patch Action Cable server class to silence default Action Cable logger

Monkey-patch Action Cable Channel and Connection classes to support logging subscribe, unsubscribe, connect & disconnect events

Update log formatters to support Action Cable log data

@xlts xlts force-pushed the xlts:action-cable branch from 7312136 to c1d1957 Jan 8, 2019

@xlts xlts referenced this pull request Jan 8, 2019

Open

Rails 5 Action Cable #248

@benlovell

This comment has been minimized.

Copy link
Collaborator

commented Jan 18, 2019

Thanks. This looks good at first glance - I'll give it a proper review over the weekend.

@xlts

This comment has been minimized.

Copy link
Contributor Author

commented Jan 22, 2019

Thx @benlovell. Let me know if anything needs explaining

@nfedyashev

This comment has been minimized.

Copy link

commented Mar 17, 2019

@benlovell is there anything missing?

@xlts thanks for your work btw!

@xlts

This comment has been minimized.

Copy link
Contributor Author

commented Apr 13, 2019

Thanks @nfedyashev! @benlovell are there chances of having this reviewed anytime soon?

@benlovell benlovell merged commit 2347f63 into roidrage:master Apr 13, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@benlovell

This comment has been minimized.

Copy link
Collaborator

commented Apr 13, 2019

Thanks for this. Sorry for the delay! I’ll cut a release today or tomorrow. 💖

@xlts

This comment has been minimized.

Copy link
Contributor Author

commented Apr 15, 2019

Cool! In the next few days I'll try to work on updates to Readme so that we have this documented & explained properly.

@benlovell

This comment has been minimized.

Copy link
Collaborator

commented Apr 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.