@@ -176,9 +176,7 @@ export class PreviewAppController extends EventEmitter implements IPreviewAppCon
176
176
const status = await this . $hmrStatusService . getHmrStatus ( device . id , hmrHash ) ;
177
177
if ( ! status ) {
178
178
this . devicesCanExecuteHmr [ device . id ] = false ;
179
- const noStatusWarning = this . getDeviceMsg ( device . name ,
180
- "Unable to get LiveSync status from the Preview app. Ensure the app is running in order to sync changes." ) ;
181
- this . $logger . warn ( noStatusWarning ) ;
179
+ this . $logger . warn ( `Unable to get LiveSync status from the Preview app for device ${ this . getDeviceDisplayName ( device ) } . Ensure the app is running in order to sync changes.` ) ;
182
180
} else {
183
181
this . devicesCanExecuteHmr [ device . id ] = status === HmrConstants . HMR_SUCCESS_STATUS ;
184
182
}
@@ -194,20 +192,20 @@ export class PreviewAppController extends EventEmitter implements IPreviewAppCon
194
192
} ) ) ;
195
193
}
196
194
197
- private getDeviceMsg ( deviceId : string , message : string ) {
198
- return `[ ${ deviceId } ] ${ message } ` ;
195
+ private getDeviceDisplayName ( device : Device ) {
196
+ return `${ device . name } ( ${ device . id } )` . cyan ;
199
197
}
200
198
201
199
private async getInitialFilesForDeviceSafe ( data : IPreviewAppLiveSyncData , device : Device ) : Promise < FilesPayload > {
202
200
const platform = device . platform ;
203
- this . $logger . info ( `Start sending initial files for device ' ${ device . name } ' .` ) ;
201
+ this . $logger . info ( `Start sending initial files for device ${ this . getDeviceDisplayName ( device ) } .` ) ;
204
202
205
203
try {
206
204
const payloads = this . $previewAppFilesService . getInitialFilesPayload ( data , platform ) ;
207
- this . $logger . info ( `Successfully sent initial files for device ' ${ device . name } ' .` ) ;
205
+ this . $logger . info ( `Successfully sent initial files for device ${ this . getDeviceDisplayName ( device ) } .` ) ;
208
206
return payloads ;
209
207
} catch ( err ) {
210
- this . $logger . warn ( `Unable to apply changes for device ' ${ device . name } ' . Error is: ${ err } , ${ stringify ( err ) } ` ) ;
208
+ this . $logger . warn ( `Unable to apply changes for device ${ this . getDeviceDisplayName ( device ) } . Error is: ${ err } , ${ stringify ( err ) } ` ) ;
211
209
}
212
210
}
213
211
@@ -218,12 +216,12 @@ export class PreviewAppController extends EventEmitter implements IPreviewAppCon
218
216
const payloads = this . $previewAppFilesService . getFilesPayload ( data , filesData , platform ) ;
219
217
payloads . deviceId = deviceId ;
220
218
if ( payloads && payloads . files && payloads . files . length ) {
221
- this . $logger . info ( `Start syncing changes for device ' ${ device . name } ' .` ) ;
219
+ this . $logger . info ( `Start syncing changes for device ${ this . getDeviceDisplayName ( device ) } .` ) ;
222
220
await this . $previewSdkService . applyChanges ( payloads ) ;
223
- this . $logger . info ( `Successfully synced '${ payloads . files . map ( filePayload => filePayload . file . yellow ) } ' for device ' ${ device . name } ' .` ) ;
221
+ this . $logger . info ( `Successfully synced '${ payloads . files . map ( filePayload => filePayload . file . yellow ) } ' for device ${ this . getDeviceDisplayName ( device ) } .` ) ;
224
222
}
225
223
} catch ( error ) {
226
- this . $logger . warn ( `Unable to apply changes for device ' ${ device . name } ' . Error is: ${ error } , ${ JSON . stringify ( error , null , 2 ) } .` ) ;
224
+ this . $logger . warn ( `Unable to apply changes for device ${ this . getDeviceDisplayName ( device ) } . Error is: ${ error } , ${ JSON . stringify ( error , null , 2 ) } .` ) ;
227
225
this . emit ( PreviewAppLiveSyncEvents . PREVIEW_APP_LIVE_SYNC_ERROR , {
228
226
error,
229
227
data,
0 commit comments