@@ -92,6 +92,11 @@ export default class Catcher {
9292 */
9393 private readonly disableVueErrorHandler : boolean = false ;
9494
95+ /**
96+ * Console log handler
97+ */
98+ private readonly consoleTracking : boolean ;
99+
95100 /**
96101 * Catcher constructor
97102 *
@@ -111,6 +116,7 @@ export default class Catcher {
111116 this . context = settings . context || undefined ;
112117 this . beforeSend = settings . beforeSend ;
113118 this . disableVueErrorHandler = settings . disableVueErrorHandler ?? false ;
119+ this . consoleTracking = settings . consoleTracking ?? true ;
114120
115121 if ( ! this . token ) {
116122 log (
@@ -136,7 +142,9 @@ export default class Catcher {
136142 } ,
137143 } ) ;
138144
139- initConsoleCatcher ( ) ;
145+ if ( this . consoleTracking ) {
146+ initConsoleCatcher ( ) ;
147+ }
140148
141149 /**
142150 * Set global handlers
@@ -237,7 +245,9 @@ export default class Catcher {
237245 * Add error to console logs
238246 */
239247
240- addErrorEvent ( event ) ;
248+ if ( this . consoleTracking ) {
249+ addErrorEvent ( event ) ;
250+ }
241251
242252 /**
243253 * Promise rejection reason is recommended to be an Error, but it can be a string:
@@ -503,7 +513,7 @@ export default class Catcher {
503513 const userAgent = window . navigator . userAgent ;
504514 const location = window . location . href ;
505515 const getParams = this . getGetParams ( ) ;
506- const consoleLogs = getConsoleLogStack ( ) ;
516+ const consoleLogs = this . consoleTracking && getConsoleLogStack ( ) ;
507517
508518 const addons : JavaScriptAddons = {
509519 window : {
@@ -522,7 +532,7 @@ export default class Catcher {
522532 addons . RAW_EVENT_DATA = this . getRawData ( error ) ;
523533 }
524534
525- if ( consoleLogs . length > 0 ) {
535+ if ( consoleLogs && consoleLogs . length > 0 ) {
526536 addons . consoleOutput = consoleLogs ;
527537 }
528538
0 commit comments