@@ -63,13 +63,34 @@ class EventHandler
6363 */
6464 private $ events ;
6565
66+ /**
67+ * Indicates if we should we add SQL queries to the breadcrumbs.
68+ *
69+ * @var bool
70+ */
71+ private $ recordSqlQueries ;
72+
6673 /**
6774 * Indicates if we should we add query bindings to the breadcrumbs.
6875 *
6976 * @var bool
7077 */
7178 private $ recordSqlBindings ;
7279
80+ /**
81+ * Indicates if we should we add Laravel logs to the breadcrumbs.
82+ *
83+ * @var bool
84+ */
85+ private $ recordLaravelLogs ;
86+
87+ /**
88+ * Indicates if we should we add queue info to the breadcrumbs.
89+ *
90+ * @var bool
91+ */
92+ private $ recordQueueInfo ;
93+
7394 /**
7495 * EventHandler constructor.
7596 *
@@ -78,8 +99,11 @@ class EventHandler
7899 */
79100 public function __construct (Dispatcher $ events , array $ config )
80101 {
81- $ this ->events = $ events ;
102+ $ this ->events = $ events ;
103+ $ this ->recordSqlQueries = ($ config ['breadcrumbs.sql_queries ' ] ?? $ config ['breadcrumbs ' ]['sql_queries ' ] ?? true ) === true ;
82104 $ this ->recordSqlBindings = ($ config ['breadcrumbs.sql_bindings ' ] ?? $ config ['breadcrumbs ' ]['sql_bindings ' ] ?? false ) === true ;
105+ $ this ->recordLaravelLogs = ($ config ['breadcrumbs.logs ' ] ?? $ config ['breadcrumbs ' ]['logs ' ] ?? true ) === true ;
106+ $ this ->recordQueueInfo = ($ config ['breadcrumbs.queue_info ' ] ?? $ config ['breadcrumbs ' ]['queue_info ' ] ?? true ) === true ;
83107 }
84108
85109 /**
@@ -189,6 +213,10 @@ protected function routeMatchedHandler(RouteMatched $match)
189213 */
190214 protected function queryHandler ($ query , $ bindings , $ time , $ connectionName )
191215 {
216+ if (!$ this ->recordSqlQueries ) {
217+ return ;
218+ }
219+
192220 $ this ->addQueryBreadcrumb ($ query , $ bindings , $ time , $ connectionName );
193221 }
194222
@@ -199,6 +227,10 @@ protected function queryHandler($query, $bindings, $time, $connectionName)
199227 */
200228 protected function queryExecutedHandler (QueryExecuted $ query )
201229 {
230+ if (!$ this ->recordSqlQueries ) {
231+ return ;
232+ }
233+
202234 $ this ->addQueryBreadcrumb ($ query ->sql , $ query ->bindings , $ query ->time , $ query ->connectionName );
203235 }
204236
@@ -240,6 +272,10 @@ private function addQueryBreadcrumb($query, $bindings, $time, $connectionName)
240272 */
241273 protected function logHandler ($ level , $ message , $ context )
242274 {
275+ if (!$ this ->recordLaravelLogs ) {
276+ return ;
277+ }
278+
243279 Integration::addBreadcrumb (new Breadcrumb (
244280 $ level ,
245281 Breadcrumb::TYPE_USER ,
@@ -256,6 +292,10 @@ protected function logHandler($level, $message, $context)
256292 */
257293 protected function messageLoggedHandler (MessageLogged $ logEntry )
258294 {
295+ if (!$ this ->recordLaravelLogs ) {
296+ return ;
297+ }
298+
259299 Integration::addBreadcrumb (new Breadcrumb (
260300 $ logEntry ->level ,
261301 Breadcrumb::TYPE_USER ,
@@ -289,6 +329,10 @@ protected function queueJobProcessingHandler(JobProcessing $event)
289329 // When a job starts, we want to push a new scope
290330 Integration::getCurrentHub ()->pushScope ();
291331
332+ if (!$ this ->recordQueueInfo ) {
333+ return ;
334+ }
335+
292336 $ job = [
293337 'job ' => $ event ->job ->getName (),
294338 'queue ' => $ event ->job ->getQueue (),
@@ -322,6 +366,10 @@ protected function commandStartingHandler(CommandStarting $event)
322366 $ scope ->setTag ('command ' , $ event ->command );
323367 });
324368
369+ if (!$ this ->recordQueueInfo ) {
370+ return ;
371+ }
372+
325373 Integration::addBreadcrumb (new Breadcrumb (
326374 Breadcrumb::LEVEL_INFO ,
327375 Breadcrumb::TYPE_USER ,
0 commit comments