@@ -281,6 +281,7 @@ export class ScreenClass {
281
281
if ( ! isImage ( currentScreen ) ) {
282
282
throw Error ( `capture requires an Image, but received ${ JSON . stringify ( currentScreen ) } ` )
283
283
}
284
+ this . providerRegistry . getLogProvider ( ) . debug ( `Capturing whole screen (0, 0, ${ currentScreen . width } , ${ currentScreen . height } )` ) ;
284
285
return this . saveImage (
285
286
currentScreen ,
286
287
fileName ,
@@ -317,6 +318,7 @@ export class ScreenClass {
317
318
if ( ! isRegion ( targetRegion ) ) {
318
319
throw Error ( `captureRegion requires an Region, but received ${ JSON . stringify ( targetRegion ) } ` )
319
320
}
321
+ this . providerRegistry . getLogProvider ( ) . debug ( `Capturing screen region ${ targetRegion . toString ( ) } ` ) ;
320
322
const regionImage = await this . providerRegistry . getScreen ( ) . grabScreenRegion ( targetRegion ) ;
321
323
if ( ! isImage ( regionImage ) ) {
322
324
throw Error ( `captureRegion requires an Image, but received ${ JSON . stringify ( regionImage ) } ` )
@@ -335,7 +337,9 @@ export class ScreenClass {
335
337
* @param regionToGrab The screen region to grab
336
338
*/
337
339
public async grabRegion ( regionToGrab : Region | Promise < Region > ) : Promise < Image > {
338
- return this . providerRegistry . getScreen ( ) . grabScreenRegion ( await regionToGrab ) ;
340
+ const targetRegion = await regionToGrab ;
341
+ this . providerRegistry . getLogProvider ( ) . debug ( `Grabbing screen region ${ targetRegion . toString ( ) } ` ) ;
342
+ return this . providerRegistry . getScreen ( ) . grabScreenRegion ( targetRegion ) ;
339
343
}
340
344
341
345
/**
@@ -349,6 +353,7 @@ export class ScreenClass {
349
353
throw Error ( `colorAt requires a Point, but received ${ JSON . stringify ( inputPoint ) } ` )
350
354
}
351
355
const scaledPoint = new Point ( inputPoint . x * screenContent . pixelDensity . scaleX , inputPoint . y * screenContent . pixelDensity . scaleY ) ;
356
+ this . providerRegistry . getLogProvider ( ) . debug ( `Point ${ inputPoint . toString ( ) } has been scaled by (${ screenContent . pixelDensity . scaleX } , ${ screenContent . pixelDensity . scaleY } ) into ${ scaledPoint . toString ( ) } ` ) ;
352
357
return this . providerRegistry . getImageProcessor ( ) . colorAt ( screenContent , scaledPoint ) ;
353
358
}
354
359
@@ -365,7 +370,9 @@ export class ScreenClass {
365
370
prefix : fileNamePrefix ,
366
371
type : fileFormat ,
367
372
} ) ;
373
+ this . providerRegistry . getLogProvider ( ) . info ( `Writing image to ${ outputPath } ` ) ;
368
374
await this . providerRegistry . getImageWriter ( ) . store ( { image, path : outputPath } )
375
+ this . providerRegistry . getLogProvider ( ) . debug ( `File written` ) ;
369
376
return outputPath ;
370
377
}
371
378
@@ -376,13 +383,15 @@ export class ScreenClass {
376
383
const screenImage = await this . providerRegistry . getScreen ( ) . grabScreenRegion ( searchRegion ) ;
377
384
const searchMultipleScales = params ?. searchMultipleScales ?? true ;
378
385
379
- return ( {
386
+ const findParameters = ( {
380
387
minMatch,
381
388
screenSize,
382
389
searchRegion,
383
390
screenImage,
384
391
searchMultipleScales
385
392
} ) ;
393
+ this . providerRegistry . getLogProvider ( ) . debug ( `Running image search with parameters ${ JSON . stringify ( findParameters ) } ` ) ;
394
+ return findParameters ;
386
395
}
387
396
388
397
private static async getNeedle ( template : FirstArgumentType < typeof ScreenClass . prototype . find > ) {
0 commit comments