@@ -3,7 +3,7 @@ import { injector } from "../common/yok";
33export class IOSLogFilter implements Mobile . IPlatformLogFilter {
44 // Used to recognize output related to the current project
55 // This looks for artifacts like: AppName[22432] or AppName(SomeTextHere)[23123]
6- private appOutputRegex : RegExp = / ( [ ^ \s \( \) ] + ) (?: \( [ ^ \s ] + \) ) ? \[ [ 0 - 9 ] + \] / ;
6+ private appOutputRegex : RegExp = / ( [ ^ \s \( \) ] + ) (?: \( ( [ ^ \s ] + ) \) ) ? \[ [ 0 - 9 ] + \] / ;
77
88 // Used to trim the passed messages to a simpler output
99 // Example:
@@ -13,6 +13,14 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
1313 `^.*(?:<Notice>:|<Error>:|<Warning>:|\\(NativeScript\\)|${ this . appOutputRegex . source } :){1}`
1414 ) ;
1515
16+ // Used to post filter messages that slip through but are not coming from NativeScript itself.
17+ // Looks for text in parenthesis at the beginning
18+ // Example:
19+ // (RunningBoardServices) [com.apple.runningboard:connection] Identity resolved as application<...>
20+ // ^(~~capture group~~~)^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+ // we then use this to filter out non-NativeScript lines
22+ protected postFilterRegex : RegExp = / ^ \( ( .+ ) \) \[ c o m \. a p p l e .+ \] / ;
23+
1624 private filterActive : boolean = true ;
1725
1826 private partialLine : string = null ;
@@ -59,6 +67,10 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
5967 // of this filter may be used accross multiple projects.
6068 const projectName = loggingOptions && loggingOptions . projectName ;
6169 this . filterActive = matchResult [ 1 ] !== projectName ;
70+
71+ if ( matchResult ?. [ 2 ] ) {
72+ this . filterActive ||= matchResult [ 2 ] !== "NativeScript" ;
73+ }
6274 }
6375
6476 if ( this . filterActive ) {
@@ -71,6 +83,13 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
7183 }
7284
7385 currentLine = currentLine . trim ( ) ;
86+
87+ // post filtering: (<anything>) check if <anything> is not "NativeScript"
88+ const postFilterMatch = this . postFilterRegex . exec ( currentLine ) ;
89+ if ( postFilterMatch && postFilterMatch ?. [ 1 ] !== "NativeScript" ) {
90+ continue ;
91+ }
92+
7493 output += currentLine + "\n" ;
7594 }
7695
0 commit comments