@@ -9,6 +9,9 @@ import EventBus from "@vertx/eventbus-bridge-client.js";
99import LiveInstrumentCommand from "../model/command/LiveInstrumentCommand" ;
1010import CommandType from "../model/command/CommandType" ;
1111import VariableUtil from "../util/VariableUtil" ;
12+ import SourcePlusPlus from "../SourcePlusPlus" ;
13+
14+ const debugLog = ( ...args : any [ ] ) => SourcePlusPlus . debugLog ( args ) ;
1215
1316export interface VariableInfo {
1417 block : Runtime . PropertyDescriptor [ ]
@@ -221,6 +224,7 @@ export default class LiveInstrumentRemote {
221224 }
222225
223226 private async setBreakpoint ( scriptId : string , line : number ) : Promise < string > {
227+ debugLog ( `Setting breakpoint at ${ scriptId } :${ line } ` ) ;
224228 if ( this . pendingBreakpoints . has ( scriptId + ':' + line ) ) {
225229 return this . pendingBreakpoints . get ( scriptId + ':' + line ) ;
226230 }
@@ -253,6 +257,7 @@ export default class LiveInstrumentRemote {
253257 }
254258
255259 async addInstrument ( instrument : LiveInstrument ) : Promise < void > {
260+ debugLog ( `Adding instrument: ${ instrument . id } ` ) ;
256261 if ( this . instruments . get ( instrument . id ) || this . instrumentCache . get ( instrument . id ) ) {
257262 return ; // Instrument already exists or is in the cache
258263 }
@@ -287,6 +292,7 @@ export default class LiveInstrumentRemote {
287292 }
288293
289294 removeInstrument ( instrumentId : string ) {
295+ debugLog ( "Removing instrument: " + instrumentId ) ;
290296 let instrument = this . instruments . get ( instrumentId ) ;
291297
292298 if ( ! instrument ) {
@@ -338,6 +344,7 @@ export default class LiveInstrumentRemote {
338344 }
339345
340346 handleConditionalFailed ( instrument : LiveInstrument , error : string ) {
347+ debugLog ( "Conditional failed for instrument: " + instrument . id + " - " + error ) ;
341348 this . removeInstrument ( instrument . id ) ;
342349 this . eventBus . publish ( "spp.processor.status.live-instrument-removed" , {
343350 occurredAt : Date . now ( ) ,
@@ -349,6 +356,7 @@ export default class LiveInstrumentRemote {
349356 // TODO: Call this regularly to clean up old instruments
350357 // TODO: Ensure the cache doesn't get too large
351358 private cleanCache ( ) {
359+ debugLog ( "Cleaning cache" ) ;
352360 let now = Date . now ( ) ;
353361 this . instrumentCache . forEach ( ( value , key ) => {
354362 if ( now - value . timeCached > 1000 * 60 * 60 ) {
0 commit comments