File tree Expand file tree Collapse file tree 2 files changed +28
-1
lines changed
Expand file tree Collapse file tree 2 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 55module . exports = {
66 enabled : false , // Whether recording is enabled
77 autoStart : true , // Start recording automatically when Rollbar initializes
8+ debug : {
9+ logEmits : false , // Whether to log emitted events
10+ } ,
811
912 // Recording options
1013 inlineStylesheet : true , // Whether to inline stylesheets to improve replay accuracy
Original file line number Diff line number Diff line change @@ -140,14 +140,18 @@ export default class Recorder {
140140
141141 this . #stopFn = this . #recordFn( {
142142 emit : ( event , isCheckout ) => {
143+ if ( this . options . debug ?. logEmits ) {
144+ this . _logEvent ( event , isCheckout ) ;
145+ }
146+
143147 if ( isCheckout ) {
144148 this . #events. previous = this . #events. current ;
145149 this . #events. current = [ ] ;
146150 }
147151
148152 this . #events. current . push ( event ) ;
149153 } ,
150- checkoutEveryNms : 300000 , // 5 minutes
154+ checkoutEveryNms : 5 * 60 * 1000 , // 5 minutes
151155 ...this . options ,
152156 } ) ;
153157
@@ -178,4 +182,24 @@ export default class Recorder {
178182 current : [ ] ,
179183 } ;
180184 }
185+
186+ _logEvent ( event , isCheckout ) {
187+ console . log (
188+ `Recorder: ${ isCheckout ? 'checkout' : '' } event\n` ,
189+ ( ( e ) => {
190+ const seen = new WeakSet ( ) ;
191+ return JSON . stringify (
192+ e ,
193+ ( _ , v ) => {
194+ if ( typeof v === 'object' && v !== null ) {
195+ if ( seen . has ( v ) ) return '[Circular]' ;
196+ seen . add ( v ) ;
197+ }
198+ return v ;
199+ } ,
200+ 2 ,
201+ ) ;
202+ } ) ( event ) ,
203+ ) ;
204+ }
181205}
You can’t perform that action at this time.
0 commit comments