Skip to content

Commit 008dfe9

Browse files
authored
Collect dumps on message collector (#1759)
1 parent 22215b7 commit 008dfe9

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

config/debugbar.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@
203203
'memory_usage' => false, // Calculated by subtracting memory start and end, it may be inaccurate
204204
],
205205
'messages' => [
206-
'trace' => true, // Trace the origin of the debug message
206+
'trace' => true, // Trace the origin of the debug message
207+
'capture_dumps' => false, // Capture laravel `dump();` as message
207208
],
208209
'memory' => [
209210
'reset_peak' => false, // run memory_reset_peak_usage before collecting

src/LaravelDebugbar.php

+6
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ public function boot()
188188
if ($config->get('debugbar.options.messages.trace', true)) {
189189
$this['messages']->collectFileTrace(true);
190190
}
191+
192+
if ($config->get('debugbar.options.messages.capture_dumps', false)) {
193+
\Symfony\Component\VarDumper\VarDumper::setHandler(function ($var) {
194+
self::addMessage($var);
195+
});
196+
}
191197
}
192198

193199
if ($this->shouldCollect('time', true)) {

0 commit comments

Comments
 (0)