@@ -109,11 +109,11 @@ export class MongoInstance extends EventEmitter {
109109
110110 this . on ( MongoInstanceEvents . instanceReady , ( ) => {
111111 this . isInstanceReady = true ;
112- this . debug ( 'Instance is ready!' ) ;
112+ this . debug ( 'constructor: Instance is ready!' ) ;
113113 } ) ;
114114
115115 this . on ( MongoInstanceEvents . instanceError , async ( err : string | Error ) => {
116- this . debug ( `Instance has thrown an Error: ${ err . toString ( ) } ` ) ;
116+ this . debug ( `constructor: Instance has thrown an Error: ${ err . toString ( ) } ` ) ;
117117 this . isInstanceReady = false ;
118118 this . isInstancePrimary = false ;
119119
@@ -186,7 +186,7 @@ export class MongoInstance extends EventEmitter {
186186 * @fires MongoInstance#instanceStarted
187187 */
188188 async start ( ) : Promise < this> {
189- this . debug ( 'run ' ) ;
189+ this . debug ( 'start ' ) ;
190190 this . isInstancePrimary = false ;
191191 this . isInstanceReady = false ;
192192 this . isReplSet = false ;
@@ -224,15 +224,15 @@ export class MongoInstance extends EventEmitter {
224224 * Shutdown all related processes (Mongod Instance & Killer Process)
225225 */
226226 async stop ( ) : Promise < MongoInstance > {
227- this . debug ( 'kill : Called .kill ():' ) ;
227+ this . debug ( 'stop : Called .stop ():' ) ;
228228
229229 if ( ! isNullOrUndefined ( this . childProcess ) ) {
230230 // try to run "replSetStepDown" before running "killProcess" (gracefull "SIGINT")
231231 // running "&& this.isInstancePrimary" otherwise "replSetStepDown" will fail with "MongoError: not primary so can't step down"
232232 if ( this . isReplSet && this . isInstancePrimary ) {
233233 let con : MongoClient | undefined ;
234234 try {
235- log ( 'kill : instanceStopFailed event' ) ;
235+ log ( 'stop : instanceStopFailed event' ) ;
236236 const port = this . instanceOpts . port ;
237237 const ip = this . instanceOpts . ip ;
238238 assertion (
@@ -276,16 +276,16 @@ export class MongoInstance extends EventEmitter {
276276 await killProcess ( this . childProcess , 'childProcess' ) ;
277277 this . childProcess = undefined ; // reset reference to the childProcess for "mongod"
278278 } else {
279- this . debug ( 'kill : childProcess: nothing to shutdown, skipping' ) ;
279+ this . debug ( 'stop : childProcess: nothing to shutdown, skipping' ) ;
280280 }
281281 if ( ! isNullOrUndefined ( this . killerProcess ) ) {
282282 await killProcess ( this . killerProcess , 'killerProcess' ) ;
283283 this . killerProcess = undefined ; // reset reference to the childProcess for "mongo_killer"
284284 } else {
285- this . debug ( 'kill : killerProcess: nothing to shutdown, skipping' ) ;
285+ this . debug ( 'stop : killerProcess: nothing to shutdown, skipping' ) ;
286286 }
287287
288- this . debug ( 'kill : Instance Finished Shutdown' ) ;
288+ this . debug ( 'stop : Instance Finished Shutdown' ) ;
289289
290290 return this ;
291291 }
@@ -363,10 +363,10 @@ export class MongoInstance extends EventEmitter {
363363 // because for mongodb any event on windows (like SIGINT / SIGTERM) will result in an code 12
364364 // https://docs.mongodb.com/manual/reference/exit-codes/#12
365365 if ( ( process . platform === 'win32' && code != 12 && code != 0 ) || code != 0 ) {
366- this . debug ( 'Mongod instance closed with an non-0 (or non 12 on windows) code!' ) ;
366+ this . debug ( 'closeHandler: Mongod instance closed with an non-0 (or non 12 on windows) code!' ) ;
367367 }
368368
369- this . debug ( `CLOSE : ${ code } ` ) ;
369+ this . debug ( `closeHandler : ${ code } ` ) ;
370370 this . emit ( MongoInstanceEvents . instanceClosed , code ) ;
371371 }
372372
@@ -376,7 +376,7 @@ export class MongoInstance extends EventEmitter {
376376 * @fires MongoInstance#instanceSTDERR
377377 */
378378 stderrHandler ( message : string | Buffer ) : void {
379- this . debug ( `STDERR : ${ message . toString ( ) } ` ) ;
379+ this . debug ( `stderrHandler : ${ message . toString ( ) } ` ) ;
380380 this . emit ( MongoInstanceEvents . instanceSTDERR , message ) ;
381381 }
382382
@@ -391,7 +391,7 @@ export class MongoInstance extends EventEmitter {
391391 */
392392 stdoutHandler ( message : string | Buffer ) : void {
393393 const line : string = message . toString ( ) . trim ( ) ; // trimming to remove extra new lines and spaces around the message
394- this . debug ( `STDOUT : ""${ line } ""` ) ; // denoting the STDOUT string with double quotes, because the stdout might also use quotes
394+ this . debug ( `stdoutHandler : ""${ line } ""` ) ; // denoting the STDOUT string with double quotes, because the stdout might also use quotes
395395 this . emit ( MongoInstanceEvents . instanceSTDOUT , line ) ;
396396
397397 // dont use "else if", because input can be multiple lines and match multiple things
@@ -437,7 +437,7 @@ export class MongoInstance extends EventEmitter {
437437 }
438438 if ( / t r a n s i t i o n t o p r i m a r y c o m p l e t e ; d a t a b a s e w r i t e s a r e n o w p e r m i t t e d / i. test ( line ) ) {
439439 this . isInstancePrimary = true ;
440- this . debug ( 'Calling all waitForPrimary resolve functions' ) ;
440+ this . debug ( 'stdoutHandler: Calling all waitForPrimary resolve functions' ) ;
441441 this . emit ( MongoInstanceEvents . instancePrimary ) ;
442442 }
443443 if ( / m e m b e r [ \d \. : ] + i s n o w i n s t a t e \w + / i. test ( line ) ) {
0 commit comments