Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/LiveComponent/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3715,6 +3715,11 @@ Debugging Components
Need to list or debug some component issues.
The `Twig Component debug command`_ can help you.

To debug your PHP code, you can inject a `private LoggerInterface $logger` in your `__construct`.
Then you can use `$this->logger->debug('Message', ['var' => $var]);` and see the output in `var/log/dev.log`.
Comment on lines +3718 to +3719
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure this is really needed, as it applies to any component / service in Symfony apps (and you can inject a Logger with a lot of other methods,) .

We could send the user towards the documentation pages on logging, but then it would not be really about debugging.

`dump` won't display anything anywhere (not even the debug toolbar).
Copy link
Member

Choose a reason for hiding this comment

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

This is not true.

During the first render, dumps are shown either in the template or in the debug toolbar.

On following request they are shown on the profiler, like any AJAX request.

`dd` will display in your browser, but will also deadlock your component - you cannot dismiss it and continue working.
Copy link
Member

Choose a reason for hiding this comment

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

This is the same thing in a webpage. dd means dump and die.


Test Helper
-----------

Expand Down
Loading