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
Refactor: Split out LogWriter from Events (no logic change) #2798
Refactor: Split out LogWriter from Events (no logic change) #2798
Conversation
920474d
to
d589b73
Compare
@nateberkopec This PR is likely to break as other PRs are merged, so I'd like to get a preliminary review to confirm the Puma team accepts this change in principle. |
I love it! We could take this even further: if you moved lines 83+ from |
Wow, yeah! That would be the ultimate! Was trying to minimize change. That being said, lets do it as a series of two PRs. |
…puma into split-log-writer-from-events
This is shippable for me when the tests pass |
@nateberkopec this is ready to merge. Appreciate if we can merge this first before other PRs because it's likely to have conflicts. |
…ma#2798) * Split out LogWriter from Events * Improve code comment * Fix constructor interfaces * Fix file includes * Fix specs and requires * Fix LogWriter * More fixes * Fix tests * Fix specs * Fix spec * Fix more specs * Refactor: Split out LogWriter from Events * Improve comments * Fix bundle pruner Co-authored-by: shields <shields@tablecheck.com>
@nateberkopec thoughts on adding this PR to the |
@elia Sure, just make a PR |
@nateberkopec not sure if Puma is following this but I've seen other repos use a code annotation |
@johnnyshields good call, would be great if, in addition to marking them as private, a public api that covers that use case was also offered. |
I don't think that EDIT: It is still a breaking change, in that code to create a |
The class responsible for logging was split of from the Puma Events class into a new LogWriter class in PR puma/puma#2798. Rely on this location first for Puma 6 and fallback on the events class for Puma 5. Fixes #886
The class responsible for logging was split of from the Puma Events class into a new LogWriter class in PR puma/puma#2798. Rely on this location first for Puma 6 and fallback on the events class for Puma 5. Fixes #886
…iter instead of events (puma/puma#2798)
…iter instead of events (puma/puma#2798)
This PR splits the
Puma::Events
object into two separate objects,Events
andLogWriter
.Currently the
Events
object combines two completely unrelated responsibilities::on_booted
These two concerns have no dependency on each other, so they should be separate objects. As Puma newbie, the fact that logging functionality was in the Events class gave me the mistaken impression that logging somehow used the same callback hooks that events do. When the @events object is passed into other classes, it's also not clear for which of these responsibilities it will be used.
This PR does not change any application logic, but it does change the constructor interface of some classes, most notably
Puma::Server
(it adds an extra arg for a LogWriter instance.)