@@ -176,9 +176,7 @@ export class PreviewAppController extends EventEmitter implements IPreviewAppCon
176176 const status = await this . $hmrStatusService . getHmrStatus ( device . id , hmrHash ) ;
177177 if ( ! status ) {
178178 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.` ) ;
182180 } else {
183181 this . devicesCanExecuteHmr [ device . id ] = status === HmrConstants . HMR_SUCCESS_STATUS ;
184182 }
@@ -194,20 +192,20 @@ export class PreviewAppController extends EventEmitter implements IPreviewAppCon
194192 } ) ) ;
195193 }
196194
197- private getDeviceMsg ( deviceId : string , message : string ) {
198- return `[ ${ deviceId } ] ${ message } ` ;
195+ private getDeviceDisplayName ( device : Device ) {
196+ return `${ device . name } ( ${ device . id } )` . cyan ;
199197 }
200198
201199 private async getInitialFilesForDeviceSafe ( data : IPreviewAppLiveSyncData , device : Device ) : Promise < FilesPayload > {
202200 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 ) } .` ) ;
204202
205203 try {
206204 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 ) } .` ) ;
208206 return payloads ;
209207 } 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 ) } ` ) ;
211209 }
212210 }
213211
@@ -218,12 +216,12 @@ export class PreviewAppController extends EventEmitter implements IPreviewAppCon
218216 const payloads = this . $previewAppFilesService . getFilesPayload ( data , filesData , platform ) ;
219217 payloads . deviceId = deviceId ;
220218 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 ) } .` ) ;
222220 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 ) } .` ) ;
224222 }
225223 } 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 ) } .` ) ;
227225 this . emit ( PreviewAppLiveSyncEvents . PREVIEW_APP_LIVE_SYNC_ERROR , {
228226 error,
229227 data,
0 commit comments