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

[WebProfilerBundle] add extra data to logs panel #54445

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

Conversation

jon-ht
Copy link

@jon-ht jon-ht commented Mar 30, 2024

Q A
Branch? 7.1
Bug fix? no
New feature? yes
Deprecations? no
Issues N/A
License MIT

This is an attempt to add extra data to Logs panel in profiler.

I'm not convinced by this approch but I couldn't find another way to put DebugProcessor as last item. Doing so ensure that when logs are collected, extra property contains all data from previous processors.

I think this PR could help: symfony/monolog-bundle#455

Here's an example with Symfony\Bridge\Monolog\Processor\WebProcessor and Monolog\Processor\MemoryUsageProcessor enabled

image

TODO

  • Tests
  • Update changelogs

@jon-ht jon-ht marked this pull request as ready for review March 30, 2024 22:58
@carsonbot carsonbot added this to the 7.1 milestone Mar 30, 2024
@carsonbot
Copy link

Hey!

I see that this is your first PR. That is great! Welcome!

Symfony has a contribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (see https://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (see https://symfony.com/releases)
  • Features and deprecations must be submitted against the 7.1 branch.

Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change.

When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor!
If this PR is merged in a lower version branch, it will be merged up to all maintained branches within a few days.

I am going to sit back now and wait for the reviews.

Cheers!

Carsonbot

Comment on lines +33 to +36
$processors = $logger->getProcessors();
while ([] !== $logger->getProcessors()) {
$logger->popProcessor();
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really not sure about this. Adding tag priority like suggested here symfony/monolog-bundle#455 might help

Comment on lines +38 to +42
// Ensure the DebugLogger is the first processor as Monolog add processors in reverse order
$logger->pushProcessor($this->processor);
foreach ($processors as $processor) {
$logger->pushProcessor($processor);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For me this would deserve its own PR.. as this one only says "add extra data" and not "changes the order of procesors" :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, that's why I'm not 100% sure about this change. But if processors are left as is, DebugProcessor is the very last to be pushed to the list, and it will not get extra data added by next processors (because of reverse order used by Monolog).

Do you see another way to do so ? Working on CompilerPass looks pretty complex.

@javiereguiluz javiereguiluz added the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label Apr 2, 2024
@symfony symfony deleted a comment from carsonbot Apr 7, 2024
@fabpot fabpot removed the ❄️ Feature Freeze Important Pull Requests to finish before the next Symfony "feature freeze" label May 2, 2024
@fabpot fabpot modified the milestones: 7.1, 7.2 May 2, 2024
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.

None yet

5 participants