@@ -3,7 +3,7 @@ import { injector } from "../common/yok";
3
3
export class IOSLogFilter implements Mobile . IPlatformLogFilter {
4
4
// Used to recognize output related to the current project
5
5
// 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 ] + \] / ;
7
7
8
8
// Used to trim the passed messages to a simpler output
9
9
// Example:
@@ -13,6 +13,14 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
13
13
`^.*(?:<Notice>:|<Error>:|<Warning>:|\\(NativeScript\\)|${ this . appOutputRegex . source } :){1}`
14
14
) ;
15
15
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
+
16
24
private filterActive : boolean = true ;
17
25
18
26
private partialLine : string = null ;
@@ -59,6 +67,10 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
59
67
// of this filter may be used accross multiple projects.
60
68
const projectName = loggingOptions && loggingOptions . projectName ;
61
69
this . filterActive = matchResult [ 1 ] !== projectName ;
70
+
71
+ if ( matchResult ?. [ 2 ] ) {
72
+ this . filterActive ||= matchResult [ 2 ] !== "NativeScript" ;
73
+ }
62
74
}
63
75
64
76
if ( this . filterActive ) {
@@ -71,6 +83,13 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
71
83
}
72
84
73
85
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
+
74
93
output += currentLine + "\n" ;
75
94
}
76
95
0 commit comments