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

Refactor Reporter to not know about implementations #676

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

spuun
Copy link
Member

@spuun spuun commented May 14, 2024

WHAT is this pull request doing?

The Reporter class is an odd bird and only used for debugging purposes. It knows too much about classes (even accessing instance variables) which prevents refactoring.

This PR refactors Reporter to not know anything about any implementation; instead "reportable" entities must include the Reportable module and specify their reportable objects with the reportables macro.

The macro may look scary at a first glance, but it will generate a __report method that will report all specified "reportables" to the Reporter instance. This makes the Reporter only responsible for the output, while each entity is responsible for what to report.

HOW can this pull request be tested?

Run lavinmq and send USR1 to observe output.

@carlhoerberg
Copy link
Member

carlhoerberg commented May 16, 2024

What's the benefit? "Prevents refactoring"? You have to change your reportables just the same way as you have to change the Reporter today. With this PR a lot of debugging code is scattered around in individual classes.

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

Successfully merging this pull request may close these issues.

None yet

2 participants