Output data from debugger is generated at the end of Skynet code execution so you can debug code in sender and in responder - debug data from both of its will be generated.
If you want use debugger outside of listener you must use:
- use Skynet\Debug\SkynetDebug;
Then, if you want to debug any data (like variable, array or object), just use:
- $debugger = new SkynetDebug();
- $myVariable = 'some data';
- $debugger->dump($myVariable);
In Event Listener it's simpliest, becose you have access to debugger via:
- $this->debug
Example:
/src/SkynetUser/MyListener.php
- public function onResponse($context)
- {
- if($context == "afterReceive")
- {
- $myVar = $this->response->get('myVar');
- $this->debug->dump($myVar);
- }
- }
Another method in debugger is adding simple message to be shown in defined place in code:
Example:
/src/SkynetUser/MyListener.php
- public function onResponse($context)
- {
- if($context == "afterReceive")
- {
- $this->debug->txt('Im in response listener');
- }
- }
Both of this methods: dump() and txt() adds debug data to debugger registry.
All of this data will be displayed in Skynet Control Panel in "Debug" tab: