Skip to content

Commit 70fafba

Browse files
committed
fix: colons disappear from log message
1 parent e1ac117 commit 70fafba

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/services/log-source-map-service.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,13 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
8686
const fileIndex = rawMessage.lastIndexOf(LogSourceMapService.FILE_PREFIX);
8787
const deviceProjectPath = util.format(ANDROID_DEVICE_APP_ROOT_TEMPLATE, projectData.projectIdentifiers.android);
8888
let message = rawMessage;
89+
let separator = ",";
8990
let parts, filePath, line, column;
9091

9192
if (fileIndex >= 0) {
9293
const fileSubstring = rawMessage.substring(fileIndex + LogSourceMapService.FILE_PREFIX.length);
9394
//"data/data/org.nativescript.sourceMap/files/app/bundle.js, line: 304, column: 8"
94-
parts = fileSubstring.split(",");
95+
parts = fileSubstring.split(separator);
9596
if (parts.length >= 3) {
9697
// "data/data/org.nativescript.sourceMap/files/app/bundle.js"
9798
parts[0] = parts[0].replace("'", "");
@@ -101,7 +102,8 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
101102
parts[2] = parts[2].replace(" column: ", "");
102103
} else {
103104
// "data/data/org.nativescript.sourceMap/files/app/bundle.js:303:17)"
104-
parts = fileSubstring.split(":");
105+
separator = ":";
106+
parts = fileSubstring.split(separator);
105107
}
106108

107109
if (parts.length >= 3) {
@@ -113,7 +115,7 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
113115
column = parseInt(parts[2]);
114116
message = rawMessage.substring(0, fileIndex);
115117
for (let i = 3; i < parts.length; i++) {
116-
message += parts[i];
118+
message += `${parts[i]}${i === (parts.length - 1) ? "" : separator}`;
117119
}
118120
// "JS: at module.exports.push../main-view-model.ts.HelloWorldModel.onTap ("
119121
message = _.trimEnd(message, "(");
@@ -146,7 +148,7 @@ export class LogSourceMapService implements Mobile.ILogSourceMapService {
146148

147149
message = rawMessage.substring(0, fileIndex).trim();
148150
for (let i = 3; i < parts.length; i++) {
149-
message += parts[i];
151+
message += `${parts[i]}${i === (parts.length - 1) ? "" : ":"}`;
150152
}
151153
message = message.trim();
152154
}

0 commit comments

Comments
 (0)