Skip to content

Commit cd2a9c8

Browse files
author
Fatme
authored
Merge pull request #3931 from NativeScript/fatme/log-device-identifier
fix: log device identifier on success message when `tns run` command is executed
2 parents e3ae1df + c74d8a0 commit cd2a9c8

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

lib/common/services/livesync-service-base.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class LiveSyncServiceBase implements ILiveSyncServiceBase {
221221

222222
private async transferFiles(deviceAppData: Mobile.IDeviceAppData, localToDevicePaths: Mobile.ILocalToDevicePathData[], projectFilesPath: string, isFullSync: boolean): Promise<void> {
223223
this.$logger.info("Transferring project files...");
224-
this.logFilesSyncInformation(localToDevicePaths, "Transferring %s.", this.$logger.trace);
224+
this.logFilesSyncInformation(localToDevicePaths, "Transferring %s on device %s.", this.$logger.trace, deviceAppData.device.deviceInfo.identifier);
225225

226226
const canTransferDirectory = isFullSync && (this.$devicesService.isAndroidDevice(deviceAppData.device) || this.$devicesService.isiOSSimulator(deviceAppData.device));
227227
if (canTransferDirectory) {
@@ -238,13 +238,13 @@ class LiveSyncServiceBase implements ILiveSyncServiceBase {
238238
await this.$liveSyncProvider.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, isFullSync);
239239
}
240240

241-
this.logFilesSyncInformation(localToDevicePaths, "Successfully transferred %s.", this.$logger.info);
241+
this.logFilesSyncInformation(localToDevicePaths, "Successfully transferred %s on device %s.", this.$logger.info, deviceAppData.device.deviceInfo.identifier);
242242
}
243243

244-
private logFilesSyncInformation(localToDevicePaths: Mobile.ILocalToDevicePathData[], message: string, action: Function): void {
244+
private logFilesSyncInformation(localToDevicePaths: Mobile.ILocalToDevicePathData[], message: string, action: Function, deviceIdentifier: string): void {
245245
if (this.showFullLiveSyncInformation) {
246246
_.each(localToDevicePaths, (file: Mobile.ILocalToDevicePathData) => {
247-
action.call(this.$logger, util.format(message, path.basename(file.getLocalPath()).yellow));
247+
action.call(this.$logger, util.format(message, path.basename(file.getLocalPath()).yellow), deviceIdentifier);
248248
});
249249
} else {
250250
action.call(this.$logger, util.format(message, "all files"));

lib/services/livesync/platform-livesync-service-base.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ export abstract class PlatformLiveSyncServiceBase {
120120

121121
transferredFiles = await deviceLiveSyncService.transferFiles(deviceAppData, localToDevicePaths, projectFilesPath, projectData, liveSyncDeviceInfo, options);
122122

123-
this.logFilesSyncInformation(transferredFiles, "Successfully transferred %s.", this.$logger.info);
123+
this.logFilesSyncInformation(transferredFiles, "Successfully transferred %s on device %s.", this.$logger.info, deviceAppData.device.deviceInfo.identifier);
124124

125125
return transferredFiles;
126126
}
@@ -139,10 +139,10 @@ export abstract class PlatformLiveSyncServiceBase {
139139
};
140140
}
141141

142-
private logFilesSyncInformation(localToDevicePaths: Mobile.ILocalToDevicePathData[], message: string, action: Function): void {
142+
private logFilesSyncInformation(localToDevicePaths: Mobile.ILocalToDevicePathData[], message: string, action: Function, deviceIdentifier: string): void {
143143
if (localToDevicePaths && localToDevicePaths.length < 10) {
144144
_.each(localToDevicePaths, (file: Mobile.ILocalToDevicePathData) => {
145-
action.call(this.$logger, util.format(message, path.basename(file.getLocalPath()).yellow));
145+
action.call(this.$logger, util.format(message, path.basename(file.getLocalPath()).yellow), deviceIdentifier);
146146
});
147147
} else {
148148
action.call(this.$logger, util.format(message, "all files"));

0 commit comments

Comments
 (0)