From 32518184ae6c4cba532da63cb571ac3df451c824 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 22 Jul 2022 18:25:33 +0200 Subject: [PATCH 1/3] fix: ios log filtering --- lib/services/ios-log-filter.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/services/ios-log-filter.ts b/lib/services/ios-log-filter.ts index 69274a5fa8..6cf6ae7b50 100644 --- a/lib/services/ios-log-filter.ts +++ b/lib/services/ios-log-filter.ts @@ -13,6 +13,14 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter { `^.*(?::|:|:|\\(NativeScript\\)|${this.appOutputRegex.source}:){1}` ); + // Used to post filter messages that slip through but are not coming from NativeScript itself. + // Looks text in parenthesis at the beginning + // Example: + // (RunningBoardServices) [com.apple.runningboard:connection] Identity resolved as application<...> + // ^^^^^^^^^^^^^^^^^^^^ + // we then use this to filter out non-NativeScript lines + protected postFilterRegex: RegExp = /^\((.+)\)/; + private filterActive: boolean = true; private partialLine: string = null; @@ -71,6 +79,13 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter { } currentLine = currentLine.trim(); + + // post filtering: () check if is not "NativeScript" + const postFilterMatch = this.postFilterRegex.exec(currentLine); + if (postFilterMatch && postFilterMatch?.[1] !== "NativeScript") { + continue; + } + output += currentLine + "\n"; } From 487aeb753573074ccf0fc93263a5b61f631a0b75 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 22 Jul 2022 22:26:52 +0200 Subject: [PATCH 2/3] fix: log filtering on device --- lib/services/ios-log-filter.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/services/ios-log-filter.ts b/lib/services/ios-log-filter.ts index 6cf6ae7b50..f3c249c991 100644 --- a/lib/services/ios-log-filter.ts +++ b/lib/services/ios-log-filter.ts @@ -3,7 +3,7 @@ import { injector } from "../common/yok"; export class IOSLogFilter implements Mobile.IPlatformLogFilter { // Used to recognize output related to the current project // This looks for artifacts like: AppName[22432] or AppName(SomeTextHere)[23123] - private appOutputRegex: RegExp = /([^\s\(\)]+)(?:\([^\s]+\))?\[[0-9]+\]/; + private appOutputRegex: RegExp = /([^\s\(\)]+)(?:\(([^\s]+)\))?\[[0-9]+\]/; // Used to trim the passed messages to a simpler output // Example: @@ -19,7 +19,7 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter { // (RunningBoardServices) [com.apple.runningboard:connection] Identity resolved as application<...> // ^^^^^^^^^^^^^^^^^^^^ // we then use this to filter out non-NativeScript lines - protected postFilterRegex: RegExp = /^\((.+)\)/; + protected postFilterRegex: RegExp = /^\((.+)\) \[com\.apple.+\]/; private filterActive: boolean = true; @@ -67,6 +67,10 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter { // of this filter may be used accross multiple projects. const projectName = loggingOptions && loggingOptions.projectName; this.filterActive = matchResult[1] !== projectName; + + if (matchResult?.[2]) { + this.filterActive ||= matchResult[2] !== "NativeScript"; + } } if (this.filterActive) { From c79f0b853a0cda641b240490e99300937681a223 Mon Sep 17 00:00:00 2001 From: Igor Randjelovic Date: Fri, 22 Jul 2022 22:57:12 +0200 Subject: [PATCH 3/3] chore: cleanup comments --- lib/services/ios-log-filter.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/services/ios-log-filter.ts b/lib/services/ios-log-filter.ts index f3c249c991..32fa60f712 100644 --- a/lib/services/ios-log-filter.ts +++ b/lib/services/ios-log-filter.ts @@ -14,10 +14,10 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter { ); // Used to post filter messages that slip through but are not coming from NativeScript itself. - // Looks text in parenthesis at the beginning + // Looks for text in parenthesis at the beginning // Example: // (RunningBoardServices) [com.apple.runningboard:connection] Identity resolved as application<...> - // ^^^^^^^^^^^^^^^^^^^^ + // ^(~~capture group~~~)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ // we then use this to filter out non-NativeScript lines protected postFilterRegex: RegExp = /^\((.+)\) \[com\.apple.+\]/;