@@ -26,7 +26,7 @@ import { checkServerReadiness, isADiagramView } from './debugHelper';
2626import { webviews } from '../visualizer/webview' ;
2727import { extension } from '../MIExtensionContext' ;
2828import { reject } from 'lodash' ;
29- import { ERROR_LOG , INFO_LOG , logDebug } from '../util/logger' ;
29+ import { LogLevel , logDebug } from '../util/logger' ;
3030
3131export interface RuntimeBreakpoint {
3232 id : number ;
@@ -83,7 +83,7 @@ export class Debugger extends EventEmitter {
8383 try {
8484 const workspace = vscode . workspace . getWorkspaceFolder ( vscode . Uri . file ( path ) ) ;
8585 if ( ! workspace ) {
86- logDebug ( `No workspace found for path: ${ path } ` , ERROR_LOG ) ;
86+ logDebug ( `No workspace found for path: ${ path } ` , LogLevel . ERROR ) ;
8787 return ;
8888 }
8989 const projectUri = workspace . uri . fsPath ;
@@ -133,7 +133,7 @@ export class Debugger extends EventEmitter {
133133 // LS call for breakpoint info
134134 const breakpointInfo = await this . getBreakpointInformation ( breakpointPerFile , normalizedPath ) ;
135135 if ( ! breakpointInfo ) {
136- logDebug ( `No breakpoint information available for path: ${ normalizedPath } ` , ERROR_LOG ) ;
136+ logDebug ( `No breakpoint information available for path: ${ normalizedPath } ` , LogLevel . ERROR ) ;
137137 return vscodeBreakpointsPerFile ;
138138 }
139139 // map the runtime breakpoint to the breakpoint info
@@ -165,7 +165,7 @@ export class Debugger extends EventEmitter {
165165 } ;
166166 this . runtimeVscodeBreakpointMap . set ( runtimeBreakpointInfo , breakpointPerFile [ i ] ) ;
167167 } else {
168- logDebug ( `Breakpoint Information for ${ breakpointPerFile [ i ] ?. filePath } :${ breakpointPerFile [ i ] ?. line } is null` , ERROR_LOG ) ;
168+ logDebug ( `Breakpoint Information for ${ breakpointPerFile [ i ] ?. filePath } :${ breakpointPerFile [ i ] ?. line } is null` , LogLevel . ERROR ) ;
169169 }
170170 }
171171
@@ -178,7 +178,7 @@ export class Debugger extends EventEmitter {
178178 return vscodeBreakpointsPerFile ;
179179 }
180180 } catch ( error ) {
181- logDebug ( `Error updating breakpoints: ${ error } ` , ERROR_LOG ) ;
181+ logDebug ( `Error updating breakpoints: ${ error } ` , LogLevel . ERROR ) ;
182182 return Promise . reject ( error ) ;
183183 }
184184 }
@@ -187,7 +187,7 @@ export class Debugger extends EventEmitter {
187187 try {
188188 const workspace = vscode . workspace . getWorkspaceFolder ( vscode . Uri . file ( path ) ) ;
189189 if ( ! workspace ) {
190- logDebug ( `No workspace found for path: ${ path } ` , ERROR_LOG ) ;
190+ logDebug ( `No workspace found for path: ${ path } ` , LogLevel . ERROR ) ;
191191 return ;
192192 }
193193 const projectUri = workspace . uri . fsPath ;
@@ -225,7 +225,7 @@ export class Debugger extends EventEmitter {
225225 // LS call for breakpoint info
226226 const breakpointInfo = await this . getBreakpointInformation ( stepOverBreakpoints , normalizedPath ) ;
227227 if ( ! breakpointInfo ) {
228- logDebug ( `No step-over breakpoint information available for path: ${ normalizedPath } ` , ERROR_LOG ) ;
228+ logDebug ( `No step-over breakpoint information available for path: ${ normalizedPath } ` , LogLevel . ERROR ) ;
229229 return ;
230230 }
231231 // map the runtime breakpoint to the breakpoint info
@@ -257,7 +257,7 @@ export class Debugger extends EventEmitter {
257257 } ;
258258 this . stepOverBreakpointMap . set ( runtimeBreakpointInfo , stepOverBreakpoints [ i ] ) ;
259259 } else {
260- logDebug ( `Breakpoint Information for ${ stepOverBreakpoints [ i ] ?. filePath } :${ stepOverBreakpoints [ i ] ?. line } is null` , ERROR_LOG ) ;
260+ logDebug ( `Breakpoint Information for ${ stepOverBreakpoints [ i ] ?. filePath } :${ stepOverBreakpoints [ i ] ?. line } is null` , LogLevel . ERROR ) ;
261261 }
262262 }
263263 if ( this . isDebuggerActive ) {
@@ -274,7 +274,7 @@ export class Debugger extends EventEmitter {
274274 public async getBreakpointInformation ( breakpoints : RuntimeBreakpoint [ ] , filePath : string ) : Promise < BreakpointInfo [ ] > {
275275 const workspace = vscode . workspace . getWorkspaceFolder ( vscode . Uri . file ( filePath ) ) ;
276276 if ( ! workspace ) {
277- logDebug ( `No workspace found for path: ${ filePath } ` , ERROR_LOG ) ;
277+ logDebug ( `No workspace found for path: ${ filePath } ` , LogLevel . ERROR ) ;
278278 throw new Error ( `No workspace found for path: ${ filePath } ` ) ;
279279 }
280280 const projectUri = workspace . uri . fsPath ;
@@ -391,17 +391,17 @@ export class Debugger extends EventEmitter {
391391 }
392392 resolve ( ) ;
393393 } ) . catch ( ( error ) => {
394- logDebug ( `Error while sending the resume command: ${ error } ` , ERROR_LOG ) ;
394+ logDebug ( `Error while sending the resume command: ${ error } ` , LogLevel . ERROR ) ;
395395 reject ( `Error while resuming the debugger server: ${ error } ` ) ;
396396 } ) ;
397397
398398 } ) . catch ( ( error ) => {
399- logDebug ( `Error while checking server readiness: ${ error } ` , ERROR_LOG ) ;
399+ logDebug ( `Error while checking server readiness: ${ error } ` , LogLevel . ERROR ) ;
400400 reject ( error ) ;
401401 } ) ;
402402
403403 } ) . catch ( ( error ) => {
404- logDebug ( `Error while connecting the debugger to the MI server: ${ error } ` , ERROR_LOG ) ;
404+ logDebug ( `Error while connecting the debugger to the MI server: ${ error } ` , LogLevel . ERROR ) ;
405405 reject ( `Error while connecting the debugger to the MI server: ${ error } ` ) ;
406406 } ) ;
407407 } ) ;
@@ -419,7 +419,7 @@ export class Debugger extends EventEmitter {
419419
420420 // Error handling for the command client
421421 this . commandClient ?. on ( 'error' , ( error ) => {
422- logDebug ( `Command client error: ${ error } ` , ERROR_LOG ) ;
422+ logDebug ( `Command client error: ${ error } ` , LogLevel . ERROR ) ;
423423 reject ( error ) ; // Reject the promise if there's an error
424424 } ) ;
425425
@@ -430,7 +430,7 @@ export class Debugger extends EventEmitter {
430430
431431 // Error handling for the event client
432432 this . eventClient ?. on ( 'error' , ( error ) => {
433- logDebug ( `Event client error: ${ error } ` , ERROR_LOG ) ;
433+ logDebug ( `Event client error: ${ error } ` , LogLevel . ERROR ) ;
434434 reject ( error ) ;
435435 } ) ;
436436
@@ -450,7 +450,7 @@ export class Debugger extends EventEmitter {
450450 const message = incompleteMessage . slice ( 0 , newlineIndex ) ;
451451
452452 // Call a function with the received message
453- logDebug ( `Event received: ${ message } ` , INFO_LOG ) ;
453+ logDebug ( `Event received: ${ message } ` , LogLevel . INFO ) ;
454454
455455 // convert to eventData to json
456456 const eventDataJson = JSON . parse ( message ) ;
@@ -591,7 +591,7 @@ export class Debugger extends EventEmitter {
591591 let incompleteMessage = '' ;
592592
593593 // Send request on the command port
594- logDebug ( `Command: ${ request } ` , INFO_LOG ) ;
594+ logDebug ( `Command: ${ request } ` , LogLevel . INFO ) ;
595595 this . commandClient ?. write ( request ) ;
596596
597597 // Listen for response from the command port
@@ -609,7 +609,7 @@ export class Debugger extends EventEmitter {
609609 const message = incompleteMessage . slice ( 0 , newlineIndex ) ;
610610
611611 // Call a function with the received message
612- logDebug ( `Command response: ${ message } ` , INFO_LOG ) ;
612+ logDebug ( `Command response: ${ message } ` , LogLevel . INFO ) ;
613613 resolve ( message ) ; // Resolve the promise with the message
614614
615615 // Remove the processed message from incompleteMessage
@@ -644,7 +644,7 @@ export class Debugger extends EventEmitter {
644644
645645 variables . push ( jsonResponse ) ;
646646 } catch ( error ) {
647- logDebug ( `Error sending properties-command for ${ context } : ${ error } ` , ERROR_LOG ) ;
647+ logDebug ( `Error sending properties-command for ${ context } : ${ error } ` , LogLevel . ERROR ) ;
648648 }
649649 }
650650 return variables ;
0 commit comments