|
5 | 5 | - [Configuration](#configuration)
|
6 | 6 | - [Data Pruning](#data-pruning)
|
7 | 7 | - [Dashboard Authorization](#dashboard-authorization)
|
| 8 | +- [Filtering](#filtering) |
| 9 | + - [Entries](#filtering-entries) |
| 10 | + - [Batches](#filtering-batches) |
8 | 11 |
|
9 | 12 | <a name="introduction"></a>
|
10 | 13 | ## Introduction
|
@@ -98,3 +101,60 @@ Telescope exposes a dashboard at `/telescope`. By default, you will only be able
|
98 | 101 | ]);
|
99 | 102 | });
|
100 | 103 | }
|
| 104 | + |
| 105 | +<a name="filtering"></a> |
| 106 | +## Filtering |
| 107 | + |
| 108 | +<a name="filtering-entries"></a> |
| 109 | +### Entries |
| 110 | + |
| 111 | +Telescope allows you to record filtered entries by registering a callback via the `filter` method in your `app/Providers/TelescopeServiceProvider.php` file: |
| 112 | + |
| 113 | + /** |
| 114 | + * Register any application services. |
| 115 | + * |
| 116 | + * @return void |
| 117 | + */ |
| 118 | + public function register() |
| 119 | + { |
| 120 | + $this->hideSensitiveRequestDetails(); |
| 121 | + |
| 122 | + Telescope::filter(function (IncomingEntry $entry) { |
| 123 | + if ($this->app->isLocal()) { |
| 124 | + return true; |
| 125 | + } |
| 126 | + |
| 127 | + return $entry->isReportableException() || |
| 128 | + $entry->isFailedJob() || |
| 129 | + $entry->isScheduledTask() || |
| 130 | + $entry->hasMonitoredTag(); |
| 131 | + }); |
| 132 | + } |
| 133 | + |
| 134 | +<a name="filtering-batches"></a> |
| 135 | +### Batches |
| 136 | + |
| 137 | +Besides filtering at the entry level, you may also filter batches (request or console application cycles) while retaining all the entries associated with the filtered batches by using the `filterBatch` method: |
| 138 | + |
| 139 | + /** |
| 140 | + * Register any application services. |
| 141 | + * |
| 142 | + * @return void |
| 143 | + */ |
| 144 | + public function register() |
| 145 | + { |
| 146 | + $this->hideSensitiveRequestDetails(); |
| 147 | + |
| 148 | + Telescope::filterBatch(function ($entries) { |
| 149 | + if ($this->app->isLocal()) { |
| 150 | + return true; |
| 151 | + } |
| 152 | + |
| 153 | + return $entries->contains(function ($entry) { |
| 154 | + return $entry->isReportableException() || |
| 155 | + $entry->isFailedJob() || |
| 156 | + $entry->isScheduledTask() || |
| 157 | + $entry->hasMonitoredTag(); |
| 158 | + }); |
| 159 | + }); |
| 160 | + } |
0 commit comments