Skip to content

Commit b607093

Browse files
committed
Add logs, tweak
1 parent f66a3b0 commit b607093

File tree

2 files changed

+83
-69
lines changed

2 files changed

+83
-69
lines changed

docs/collectors.md

+83-69
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ These collectors can be enabled in the config:
3535
- [Cache](#cache): Display all cache events.
3636
- [Models](#models): Loaded Models
3737
- [Jobs](#jobs): Sent emails
38+
- [Logs](#logs): Logs from the log files
3839
- [Pennant](#pennant): Show Pennant flags
3940
- [Files](#files): Show the files that are included/required by PHP.
4041

@@ -88,7 +89,7 @@ To enable or disable any of the collectors, set the configuration to `true` or `
8889

8990
</details>
9091

91-
## Query Collector { #db }
92+
## Database Queries { #db }
9293

9394
<!-- md:version v1.0 -->
9495
<!-- md:feature collectors.db -->
@@ -162,7 +163,7 @@ If you want to avoid any limits, you can set the option to `null`
162163
![Query Limits](img/query-limits.png)
163164

164165

165-
## Messages Collector { #messages }
166+
## Messages { #messages }
166167

167168
<!-- md:version v1.0 -->
168169
<!-- md:feature collectors.messages -->
@@ -180,7 +181,7 @@ When calling `debug()`, the source of the call is shown and can be opened with y
180181

181182
![Messages Collector](img/messages.png)
182183

183-
## Log Collectors { #log }
184+
## Logger { #log }
184185

185186
<!-- md:version v1.0 -->
186187
<!-- md:feature collectors.log -->
@@ -189,6 +190,35 @@ When the [Messages Collector](#messages) is enabled, Log messages are added to t
189190

190191
![Monolog](img/monolog.png)
191192

193+
<details><summary>config/debugbar.php</summary>
194+
195+
```php
196+
'options' => [
197+
// ...
198+
'db' => [
199+
'with_params' => true, // Render SQL with the parameters substituted
200+
'exclude_paths' => [ // Paths to exclude entirely from the collector
201+
// 'vendor/laravel/framework/src/Illuminate/Session', // Exclude sessions queries
202+
],
203+
'backtrace' => true, // Use a backtrace to find the origin of the query in your files.
204+
'backtrace_exclude_paths' => [], // Paths to exclude from backtrace. (in addition to defaults)
205+
'timeline' => false, // Add the queries to the timeline
206+
'duration_background' => true, // Show shaded background on each query relative to how long it took to execute.
207+
'explain' => [ // Show EXPLAIN output on queries
208+
'enabled' => false,
209+
],
210+
'hints' => false, // Show hints for common mistakes
211+
'show_copy' => true, // Show copy button next to the query,
212+
'slow_threshold' => false, // Only track queries that last longer than this time in ms
213+
'memory_usage' => false, // Show queries memory usage
214+
'soft_limit' => 100, // After the soft limit, no parameters/backtrace are captured
215+
'hard_limit' => 500, // After the hard limit, queries are ignored
216+
],
217+
// ...
218+
],
219+
```
220+
</details>
221+
192222
## Views { #views }
193223

194224
<!-- md:version v1.0 -->
@@ -246,6 +276,18 @@ This shows the current route and middleware.
246276

247277
![RouteCollector](img/route.png)
248278

279+
<details><summary>config/debugbar.php</summary>
280+
281+
```php
282+
'options' => [
283+
'route' => [
284+
'label' => true, // show complete route on bar
285+
],
286+
],
287+
```
288+
289+
</details>
290+
249291
## Exceptions { #exceptions }
250292

251293
<!-- md:version v1.0 -->
@@ -326,6 +368,19 @@ This is similar to the Timeline buts adds all events. This can be a lot of data,
326368

327369
![Events](img/events.gif)
328370

371+
<details><summary>config/debugbar.php</summary>
372+
373+
```php
374+
'options' => [
375+
'events' => [
376+
'data' => false, // collect events data, listeners
377+
],
378+
],
379+
```
380+
381+
</details>
382+
383+
329384
## Auth { #auth }
330385

331386
<!-- md:version v1.2.2 -->
@@ -432,8 +487,9 @@ Show the hits/misses of the Cache in a Timeline.
432487

433488
```php
434489
'options' => [
435-
'values' => true, // collect cache values
436-
],
490+
'cache' => [
491+
'values' => true, // collect cache values
492+
], ],
437493
```
438494

439495
</details>
@@ -458,6 +514,28 @@ Show the Jobs that are dispatched from this request.
458514

459515
![Jobs Collector](img/jobs.png)
460516

517+
## Logs { #logs }
518+
519+
<!-- md:version v1.0-->
520+
<!-- md:feature collectors.logs -->
521+
<!-- md:default false -->
522+
523+
Show the most recent logs from the log files in storage/logs
524+
525+
![Logs Collector](img/logs.png)
526+
527+
<details><summary>config/debugbar.php</summary>
528+
529+
```php
530+
'options' => [
531+
'logs' => [
532+
'file' => null, // Additional files
533+
],
534+
],
535+
```
536+
537+
</details>
538+
461539
## Pennant { #pennant }
462540

463541
<!-- md:version v3.14.0 -->
@@ -479,67 +557,3 @@ Shows all the Pennant flags that are checked during this request
479557
This was mainly useful before OPcache was widely used, and this collector could be used for optimizing files. It's deprecated now.
480558

481559
![Files Collector](img/files.png)
482-
483-
## Additional options
484-
485-
<details><summary>config/debugbar.php</summary>
486-
487-
```php
488-
/*
489-
|--------------------------------------------------------------------------
490-
| Extra options
491-
|--------------------------------------------------------------------------
492-
|
493-
| Configure some DataCollectors
494-
|
495-
*/
496-
497-
'options' => [
498-
'time' => [
499-
// See above
500-
],
501-
'messages' => [
502-
'trace' => true, // Trace the origin of the debug message
503-
],
504-
'memory' => [
505-
'reset_peak' => false, // run memory_reset_peak_usage before collecting
506-
'with_baseline' => false, // Set boot memory usage as memory peak baseline
507-
'precision' => 0, // Memory rounding precision
508-
],
509-
'auth' => [
510-
'show_name' => true, // Also show the users name/email in the debugbar
511-
'show_guards' => true, // Show the guards that are used
512-
],
513-
'db' => [
514-
// See above
515-
],
516-
'mail' => [
517-
'timeline' => false, // Add mails to the timeline
518-
'show_body' => true,
519-
],
520-
'views' => [
521-
// See above
522-
],
523-
'route' => [
524-
'label' => true, // show complete route on bar
525-
],
526-
'session' => [
527-
'hiddens' => [], // hides sensitive values using array paths
528-
],
529-
'symfony_request' => [
530-
'hiddens' => [], // hides sensitive values using array paths, example: request_request.password
531-
],
532-
'events' => [
533-
'data' => false, // collect events data, listeners
534-
],
535-
'logs' => [
536-
'file' => null,
537-
],
538-
'cache' => [
539-
'values' => true, // collect cache values
540-
],
541-
],
542-
543-
```
544-
545-
</details>

docs/img/logs.png

287 KB
Loading

0 commit comments

Comments
 (0)