-
-
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! |
public static function getSubscribedEvents(): array | ||
{ | ||
return [ | ||
KernelEvents::RESPONSE => ['onKernelResponse', -2048], |
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.
perhaps unrelated, but does the console command terminate event can also be hooked here ?
so both web/cli have this log ?
edit: its done already when profiling cli output, dont know if relevant for log
This add the display of the profiler URL in the log as follows:
Thank you @nicolas-grekas for this idea.