@@ -22,6 +22,8 @@ import { truncateUuid } from './crypto'
2222
2323const className = 'CrashMonitoring'
2424
25+ const logger = getLogger ( 'crashMonitoring' )
26+
2527/**
2628 * Handles crash reporting for the extension.
2729 *
@@ -97,7 +99,7 @@ export class CrashMonitoring {
9799 try {
98100 this . #didTryCreate = true
99101 const isDevMode = getIsDevMode ( )
100- const devModeLogger : Logger | undefined = isDevMode ? getLogger ( ) : undefined
102+ const devModeLogger : Logger | undefined = isDevMode ? logger : undefined
101103 const state = await crashMonitoringStateFactory ( ) // can throw
102104 return ( this . #instance ??= new CrashMonitoring (
103105 state ,
@@ -238,7 +240,7 @@ class CrashChecker {
238240
239241 public async start ( ) {
240242 {
241- this . devLogger ?. debug ( `crashMonitoring: checkInterval ${ this . checkInterval } ` )
243+ this . devLogger ?. debug ( `checkInterval ${ this . checkInterval } ` )
242244
243245 // do an initial check
244246 await withFailCtx ( 'initialCrashCheck' , ( ) =>
@@ -253,7 +255,7 @@ class CrashChecker {
253255 // Due to sleep+wake the heartbeat has not been sent consistently. Skip 1 crash check interval
254256 // to allow for a new heartbeat to be sent
255257 if ( this . timeLag . didLag ( ) ) {
256- this . devLogger ?. warn ( 'crashMonitoring: LAG detected time lag and skipped a crash check' )
258+ this . devLogger ?. warn ( 'LAG detected time lag and skipped a crash check' )
257259 telemetry . function_call . emit ( {
258260 className : className ,
259261 functionName : 'timeLag' ,
@@ -301,7 +303,7 @@ class CrashChecker {
301303 // Example is if I hit the red square in the debug menu, it is a non-graceful shutdown. But the regular
302304 // 'x' button in the Debug IDE instance is a graceful shutdown.
303305 if ( ext . isDebug ) {
304- devLogger ?. debug ( `crashMonitoring: DEBUG instance crashed: %O` , ext )
306+ devLogger ?. debug ( `DEBUG instance crashed: %O` , ext )
305307 return
306308 }
307309
@@ -322,7 +324,7 @@ class CrashChecker {
322324 // Sanity check: ENSURE THAT AFTER === ACTUAL or this implies that our data is out of sync
323325 const afterActual = ( await state . getAllExts ( ) ) . map ( ( i ) => truncateUuid ( i . sessionId ) )
324326 devLogger ?. debug (
325- `crashMonitoring: CHECKED: Result of cleaning up crashed instances\nBEFORE: %O \nAFTER: %O \nACTUAL: %O` ,
327+ `CHECKED: Result of cleaning up crashed instances\nBEFORE: %O \nAFTER: %O \nACTUAL: %O` ,
326328 before ,
327329 after ,
328330 afterActual
@@ -408,7 +410,7 @@ function getDefaultDependencies(): MementoStateDependencies {
408410 isStateStale : ( ) => isNewOsSession ( ) ,
409411 sessionId : _getSessionId ( ) ,
410412 isDevMode : getIsDevMode ( ) ,
411- devLogger : getIsDevMode ( ) ? getLogger ( ) : undefined ,
413+ devLogger : getIsDevMode ( ) ? logger : undefined ,
412414 }
413415}
414416/**
@@ -437,8 +439,8 @@ export class FileSystemState {
437439 constructor ( protected readonly deps : MementoStateDependencies ) {
438440 this . stateDirPath = path . join ( this . deps . workDirPath , crashMonitoringDirName )
439441
440- this . deps . devLogger ?. debug ( `crashMonitoring: sessionId: ${ this . deps . sessionId . slice ( 0 , 8 ) } -...` )
441- this . deps . devLogger ?. debug ( `crashMonitoring: dir: ${ this . stateDirPath } ` )
442+ this . deps . devLogger ?. debug ( `sessionId: ${ this . deps . sessionId . slice ( 0 , 8 ) } -...` )
443+ this . deps . devLogger ?. debug ( `dir: ${ this . stateDirPath } ` )
442444 }
443445
444446 /**
@@ -484,7 +486,7 @@ export class FileSystemState {
484486 throw new CrashMonitoringError ( 'Heartbeat write validation failed' , { code : className } )
485487 }
486488
487- this . deps . devLogger ?. debug ( `crashMonitoring: HEARTBEAT sent for ${ truncateUuid ( this . ext . sessionId ) } ` )
489+ this . deps . devLogger ?. debug ( `HEARTBEAT sent for ${ truncateUuid ( this . ext . sessionId ) } ` )
488490 }
489491 const funcWithCtx = ( ) => withFailCtx ( 'sendHeartbeatState' , func )
490492 const funcWithRetries = withRetries ( funcWithCtx , { maxRetries : 6 , delay : 100 , backoff : 2 } )
@@ -571,10 +573,10 @@ export class FileSystemState {
571573 return path . join ( this . stateDirPath , extId + `.${ this . fileSuffix } ` )
572574 }
573575 public async clearState ( ) : Promise < void > {
574- this . deps . devLogger ?. debug ( 'crashMonitoring: CLEAR_STATE: Started' )
576+ this . deps . devLogger ?. debug ( 'CLEAR_STATE: Started' )
575577 await withFailCtx ( 'clearState' , async ( ) => {
576578 await nodeFs . rm ( this . stateDirPath , { force : true , recursive : true } )
577- this . deps . devLogger ?. debug ( 'crashMonitoring: CLEAR_STATE: Succeeded' )
579+ this . deps . devLogger ?. debug ( 'CLEAR_STATE: Succeeded' )
578580 } )
579581 }
580582 public async getAllExts ( ) : Promise < ExtInstanceHeartbeat [ ] > {
0 commit comments