Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[WebProfilerBundle] add extra data to logs panel#54445

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jon-ht wants to merge1 commit intosymfony:7.4
base:7.4
Choose a base branch
Loading
fromjon-ht:feat-web-profiler-log-extra-data

Conversation

jon-ht
Copy link

@jon-htjon-ht commentedMar 30, 2024
edited
Loading

QA
Branch?7.1
Bug fix?no
New feature?yes
Deprecations?no
IssuesN/A
LicenseMIT

This is an attempt to addextra data toLogs panel in profiler.

I'm not convinced by this approch but I couldn't find another way to putDebugProcessor 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#455symfony/monolog-bundle#485

Here's an example withSymfony\Bridge\Monolog\Processor\WebProcessor andMonolog\Processor\MemoryUsageProcessor enabled

image

TODO

  • Tests
  • Update changelogs

kaznovac and Koc reacted with thumbs up emoji
@jon-htjon-ht marked this pull request as ready for reviewMarch 30, 2024 22:58
@carsonbotcarsonbot added this to the7.1 milestoneMar 30, 2024
@carsonbot
Copy link

Hey!

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

Symfony has acontribution guide which I suggest you to read.

In short:

  • Always add tests
  • Keep backward compatibility (seehttps://symfony.com/bc).
  • Bug fixes must be submitted against the lowest maintained branch where they apply (seehttps://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 heresymfony/monolog-bundle#455 might help

smnandre reacted with thumbs up emoji
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
Member

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 onCompilerPass looks pretty complex.

@javiereguiluzjaviereguiluz added the ❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze" labelApr 2, 2024
@symfonysymfony deleted a comment fromcarsonbotApr 7, 2024
@fabpotfabpot removed the ❄️ Feature FreezeImportant Pull Requests to finish before the next Symfony "feature freeze" labelMay 2, 2024
@fabpotfabpot modified the milestones:7.1,7.2May 2, 2024
@fabpotfabpot modified the milestones:7.2,7.3Nov 20, 2024
@fabpot
Copy link
Member

What's the status of this PR@jon-ht?

@jon-ht
Copy link
Author

jon-ht commentedApr 8, 2025
edited
Loading

Hi@fabpot

I didn't take time to push further this PR. I'm still waiting forsymfony/monolog-bundle#485 (previouslysymfony/monolog-bundle#455) to be accepted/merged, this will also resolve#54445 (comment) as pointed out by@smnandre

@stof
Copy link
Member

stof commentedApr 8, 2025

I don't see how the MonologBundle PR would solve this. The DebugProcessor is added by a configurator (to add it conditionally), and so it won't benefit from the fact that processors registered by the MonologBundle compiler pass can be sorted explicitly or no (the configurator will always be called after the method calls added in the service definition)

@jon-ht
Copy link
Author

@stof Maybe it's not a requirement for my PR, but the changes I've added toDebugLoggerConfigurator look more like a hack instead of a proper fix

I thought that adding some king of tag priority will have an effect on how/whenDebugLoggerConfigurator is called, but I might be wrong

If thediffs here are OK for you, I'm fine. But if not, do you have any idea on how to do this ?

publicfunctionpushDebugLogger(Logger$logger):void
{
if ($this->processor) {
$processors =$logger->getProcessors();
while ([] !==$logger->getProcessors()) {
$logger->popProcessor();
}
// Ensure the DebugLogger is the first processor as Monolog add processors in reverse order
$logger->pushProcessor($this->processor);
foreach ($processorsas$processor) {
$logger->pushProcessor($processor);
}
}
}

@fabpotfabpot modified the milestones:7.3,7.4May 26, 2025
@stof
Copy link
Member

The DebugLoggerConfigurator is registered as the service configurator in the Definition. It has strictly nothing to do with the calls being added by the tags, and so won't be affected by it.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@smnandresmnandresmnandre left review comments

Assignees
No one assigned
Projects
None yet
Milestone
7.4
Development

Successfully merging this pull request may close these issues.

6 participants
@jon-ht@carsonbot@fabpot@stof@smnandre@javiereguiluz

[8]ページ先頭

©2009-2025 Movatter.jp