Skip to content

Included file, row and column information in iOS log output #2130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions lib/services/ios-log-filter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ export class IOSLogFilter implements Mobile.IPlatformLogFilter {
}
// 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 the first part and leaves only the message as specified by the call to console.log function.
// This removes the unnecessary information and makes the log consistent with Android.
let logIndex = data.indexOf("CONSOLE LOG");
if (logIndex !== -1) {
let i = 4;
while(i) { logIndex = data.indexOf(':', logIndex+1); i --; }
if (logIndex > 0) {
data = "JS:" + data.substring(logIndex+1, data.length);
// 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();
Expand Down