diff --git a/lib/bootstrap.ts b/lib/bootstrap.ts index 5f13a02e0a..d61bc3bc2b 100644 --- a/lib/bootstrap.ts +++ b/lib/bootstrap.ts @@ -62,7 +62,7 @@ $injector.require("mobilePlatformsCapabilities", "./mobile-platforms-capabilitie $injector.require("commandsServiceProvider", "./providers/commands-service-provider"); $injector.require("deviceAppDataProvider", "./providers/device-app-data-provider"); -$injector.require("deviceLogProvider", "./providers/device-log-provider"); +$injector.require("deviceLogProvider", "./common/mobile/device-log-provider"); $injector.require("broccoliBuilder", "./tools/broccoli/builder"); $injector.require("nodeModulesTree", "./tools/broccoli/trees/node-modules-tree"); diff --git a/lib/common b/lib/common index e195212386..4533e2a011 160000 --- a/lib/common +++ b/lib/common @@ -1 +1 @@ -Subproject commit e1952123867e650bad88f3b1b7a58e2e5ac0fe8f +Subproject commit 4533e2a011ef76064da8158dd764b207fed26e51 diff --git a/lib/providers/device-log-provider.ts b/lib/providers/device-log-provider.ts deleted file mode 100644 index 3b2230f127..0000000000 --- a/lib/providers/device-log-provider.ts +++ /dev/null @@ -1,38 +0,0 @@ -/// -"use strict"; - -export class DeviceLogProvider implements Mobile.IDeviceLogProvider { - //sample line is "I/Web Console( 4438): Received Event: deviceready at file:///storage/emulated/0/Icenium/com.telerik.TestApp/js/index.js:48" - private static LINE_REGEX = /.\/(.+?)\s*\(\s*\d+?\): (.*)/; - // sample line is "11-23 12:39:07.310 1584 1597 I art : Background sticky concurrent mark sweep GC freed 21966(1780KB) AllocSpace objects, 4(80KB) LOS objects, 77% free, 840KB/3MB, paused 4.018ms total 158.629ms" - private static API_LEVEL_23_LINE_REGEX = /.+?\s+?(?:[A-Z]\s+?)([A-Za-z ]+?)\s+?\: (.*)/; - - constructor(private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants, - private $logger: ILogger) { } - - public logData(lineText: string, platform: string, deviceIdentifier: string): void { - if (!platform || platform.toLowerCase() === this.$devicePlatformsConstants.iOS.toLowerCase()) { - this.$logger.out(lineText); - } else if (platform === this.$devicePlatformsConstants.Android) { - let log = this.getConsoleLogFromLine(lineText); - if (log) { - if (log.tag) { - this.$logger.out(`${log.tag}: ${log.message}`); - } else { - this.$logger.out(log.message); - } - } - } - } - - private getConsoleLogFromLine(lineText: String): any { - let acceptedTags = ["chromium", "Web Console", "JS"]; - let match = lineText.match(DeviceLogProvider.LINE_REGEX) || lineText.match(DeviceLogProvider.API_LEVEL_23_LINE_REGEX); - if (match && acceptedTags.indexOf(match[1].trim()) !== -1) { - return {tag: match[1].trim(), message: match[2]}; - } - let matchingTag = _.any(acceptedTags, (tag: string) => { return lineText.indexOf(tag) !== -1; }); - return matchingTag ? { message: lineText } : null; - } -} -$injector.register("deviceLogProvider", DeviceLogProvider);