-
-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathios-log-filter.ts
34 lines (29 loc) · 1.13 KB
/
ios-log-filter.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
export class IOSLogFilter implements Mobile.IPlatformLogFilter {
constructor(private $loggingLevels: Mobile.ILoggingLevels) { }
public filterData(data: string, logLevel: string, pid?: string): string {
if (pid && data && data.indexOf(`[${pid}]`) === -1) {
return null;
}
if (data) {
if (data.indexOf("SecTaskCopyDebugDescription") !== -1 ||
data.indexOf("NativeScript loaded bundle") !== -1 ||
(data.indexOf("assertion failed:") !== -1 && data.indexOf("libxpc.dylib") !== -1)) {
return null;
}
// CONSOLE LOG messages comme in the following form:
// <date> <domain> <app>[pid] CONSOLE LOG file:///location:row:column: <actual message goes here>
// This code removes unnecessary information from log messages. The output looks like:
// CONSOLE LOG file:///location:row:column: <actual message goes here>
if (pid) {
let searchString = "["+pid+"]: ";
let pidIndex = data.indexOf(searchString);
if (pidIndex > 0) {
data = data.substring(pidIndex + searchString.length, data.length);
}
}
return data.trim();
}
return data;
}
}
$injector.register("iOSLogFilter", IOSLogFilter);