-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[WebProfilerBundle] display profiler url in logs #60505
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
base: 7.3
Are you sure you want to change the base?
[WebProfilerBundle] display profiler url in logs #60505
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice feature.
Is it something we want to be opt-in using the config? Or the profiler
channel is enough if someone wants to silent this log entries.
@@ -4,6 +4,8 @@ CHANGELOG | |||
7.3 | |||
--- | |||
|
|||
* Display profiler URL in logs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are feature freeze for 7.3, hopefully this feature will be for 7.4. You can add the 7.4 title.
return; | ||
} | ||
|
||
$this->logger->debug(\sprintf('See profiler at %s', $this->urlGenerator->generate('_profiler', ['token' => $response->headers->get('X-Debug-Token')], UrlGeneratorInterface::ABSOLUTE_URL))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logger should do the interpolation. Does it work like this?
$this->logger->debug(\sprintf('See profiler at %s', $this->urlGenerator->generate('_profiler', ['token' => $response->headers->get('X-Debug-Token')], UrlGeneratorInterface::ABSOLUTE_URL))); | |
$this->logger->debug('See profiler at {profiler_url}', ['profiler_url' => $this->urlGenerator->generate('_profiler', ['token' => $response->headers->get('X-Debug-Token')], UrlGeneratorInterface::ABSOLUTE_URL)]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not use directly X-Debug-Token-Link
header?
src/Symfony/Bundle/WebProfilerBundle/EventListener/ProfilerLinkLogListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/WebProfilerBundle/EventListener/ProfilerLinkLogListener.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/WebProfilerBundle/EventListener/ProfilerLinkLogListener.php
Outdated
Show resolved
Hide resolved
…kLogListener.php Co-authored-by: Christophe Coevoet <stof@notk.org>
Cool thanks for digging this idea 💡;)
Please no! That'd ruin the DX improvement this provides! |
src/Symfony/Bundle/WebProfilerBundle/EventListener/ProfilerLinkLogListener.php
Show resolved
Hide resolved
I'm wondering if it would be possible, using some monolog formatter, to add a link to the profiler on the already existing |
I don't know what is the best. I'll try it and we will see. |
This add the display of the profiler URL in the log as follows:
Thank you @nicolas-grekas for this idea.