Skip to content

Commit d81817a

Browse files
Fatme Havaluovarosen-vladimirov
Fatme Havaluova
authored andcommitted
Show application output from livesync command
#1130
1 parent 441f927 commit d81817a

File tree

4 files changed

+32
-9
lines changed

4 files changed

+32
-9
lines changed

lib/commands/livesync.ts

-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export class LivesyncCommand implements ICommand {
99
private $errors: IErrors) { }
1010

1111
public execute(args: string[]): IFuture<void> {
12-
this.$options.justlaunch = true;
1312
return this.$usbLiveSyncService.liveSync(args[0]);
1413
}
1514

lib/providers/device-log-provider.ts

+31-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,38 @@
22
"use strict";
33

44
export class DeviceLogProvider implements Mobile.IDeviceLogProvider {
5-
constructor(private $logger: ILogger) { }
5+
//sample line is "I/Web Console( 4438): Received Event: deviceready at file:///storage/emulated/0/Icenium/com.telerik.TestApp/js/index.js:48"
6+
private static LINE_REGEX = /.\/(.+?)\s*\(\s*(\d+?)\): (.*)/;
67

7-
public logData(line: string, platform: string, deviceIdentifier: string): void {
8-
this.$logger.out(line);
8+
constructor(private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
9+
private $logger: ILogger) { }
10+
11+
public logData(lineText: string, platform: string, deviceIdentifier: string): void {
12+
if (!platform || platform.toLowerCase() === this.$devicePlatformsConstants.iOS.toLowerCase()) {
13+
this.$logger.out(lineText);
14+
} else if (platform === this.$devicePlatformsConstants.Android) {
15+
let log = this.getConsoleLogFromLine(lineText);
16+
if (log) {
17+
if (log.tag) {
18+
this.$logger.out(`${log.tag}: ${log.message}`);
19+
} else {
20+
this.$logger.out(log.message);
21+
}
22+
}
23+
}
24+
}
25+
26+
private getConsoleLogFromLine(lineText: String): any {
27+
let acceptedTags = ["chromium", "Web Console", "JS"];
28+
let match = lineText.match(DeviceLogProvider.LINE_REGEX);
29+
if (match) {
30+
if(acceptedTags.indexOf(match[1]) !== -1) {
31+
return {tag: match[1], message: match[3]};
32+
}
33+
} else if (_.any(acceptedTags, (tag: string) => { return lineText.indexOf(tag) !== -1; })) {
34+
return {message: match[3]};
35+
}
36+
return null;
937
}
1038
}
1139
$injector.register("deviceLogProvider", DeviceLogProvider);

lib/services/platform-service.ts

-4
Original file line numberDiff line numberDiff line change
@@ -353,10 +353,6 @@ export class PlatformService implements IPlatformService {
353353
return (() => {
354354
platformData.platformProjectService.deploy(device.deviceInfo.identifier).wait();
355355
device.deploy(packageFile, this.$projectData.projectId).wait();
356-
357-
if (!this.$options.justlaunch) {
358-
device.openDeviceLogStream();
359-
}
360356
}).future<void>()();
361357
};
362358
this.$devicesService.execute(action).wait();

0 commit comments

Comments
 (0)