Skip to content

Commit 791f6ab

Browse files
authored
Merge pull request #2130 from NativeScript/raikov/ios-log-filtering
Included file, row and column information in iOS log output
2 parents 77bfb74 + f77ce2f commit 791f6ab

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

lib/services/ios-log-filter.ts

+7-8
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
1616
}
1717
// CONSOLE LOG messages comme in the following form:
1818
// <date> <domain> <app>[pid] CONSOLE LOG file:///location:row:column: <actual message goes here>
19-
// This code removes the first part and leaves only the message as specified by the call to console.log function.
20-
// This removes the unnecessary information and makes the log consistent with Android.
21-
let logIndex = data.indexOf("CONSOLE LOG");
22-
if (logIndex !== -1) {
23-
let i = 4;
24-
while(i) { logIndex = data.indexOf(':', logIndex+1); i --; }
25-
if (logIndex > 0) {
26-
data = "JS:" + data.substring(logIndex+1, data.length);
19+
// This code removes unnecessary information from log messages. The output looks like:
20+
// CONSOLE LOG file:///location:row:column: <actual message goes here>
21+
if (pid) {
22+
let searchString = "["+pid+"]: ";
23+
let pidIndex = data.indexOf(searchString);
24+
if (pidIndex > 0) {
25+
data = data.substring(pidIndex + searchString.length, data.length);
2726
}
2827
}
2928
return data.trim();

0 commit comments

Comments
 (0)