@studio/log
Advanced tools
+11
-0
| # Changes | ||
| ## 1.7.2 | ||
| - 🐛 Fix --map if chunks have multiple lines | ||
| > When passing `--map sourcemaps.map` to `emojilog`, the created transform | ||
| > stream expected each chunk to contain a single line. With this change, | ||
| > the sourcemaps lookup also works for multiline chunks. | ||
| - ✨ Use Sinon 5 default sandbox | ||
| - 📚 Fix typo in message docs | ||
| ## 1.7.1 | ||
@@ -4,0 +15,0 @@ |
+22
-13
@@ -17,17 +17,26 @@ /* | ||
| const transform = new Transform({ | ||
| transform: (chunk, enc, callback) => { | ||
| let row = chunk.toString(); | ||
| const match = row.match(/at (.+) \(.+:([0-9]+):([0-9]+)\)/i); | ||
| if (match) { | ||
| const pos = mapper.originalPositionFor({ | ||
| line: Number(match[2]), | ||
| column: Number(match[3]) | ||
| }); | ||
| if (pos.line) { | ||
| const prefix = row.substring(0, match.index); | ||
| const name = pos.name || match[1]; | ||
| row = `${prefix}at ${name} (${pos.source}:${pos.line}:${pos.column})`; | ||
| transform(chunk, enc, callback) { | ||
| let str = chunk.toString(); | ||
| let p = str.indexOf('\n'); | ||
| while (p !== -1) { | ||
| let row = str.substring(0, p); | ||
| const match = row.match(/at (.+) \(.+:([0-9]+):([0-9]+)\)/i); | ||
| if (match) { | ||
| const pos = mapper.originalPositionFor({ | ||
| line: Number(match[2]), | ||
| column: Number(match[3]) | ||
| }); | ||
| if (pos.line) { | ||
| const prefix = row.substring(0, match.index); | ||
| const name = pos.name || match[1]; | ||
| const source = pos.source; | ||
| row = `${prefix}at ${name} (${source}:${pos.line}:${pos.column})`; | ||
| } | ||
| } | ||
| this.push(row); | ||
| this.push('\n'); | ||
| str = str.substring(p + 1); | ||
| p = str.indexOf('\n'); | ||
| } | ||
| callback(null, row); | ||
| callback(null, str); | ||
| } | ||
@@ -34,0 +43,0 @@ }); |
+2
-2
| { | ||
| "name": "@studio/log", | ||
| "version": "1.7.1", | ||
| "version": "1.7.2", | ||
| "description": "A tiny JSON logger with emoji support", | ||
@@ -40,3 +40,3 @@ "bin": { | ||
| "mocha": "^4.0.0", | ||
| "sinon": "^4.0.1", | ||
| "sinon": "^5.0.0-next.4", | ||
| "uglify-es": "^3.3.8" | ||
@@ -43,0 +43,0 @@ }, |
+1
-1
@@ -129,3 +129,3 @@ # Studio Log | ||
| - The `topic` is added as the `"topic"`. | ||
| - If `message` is present, it's added as the `"msd"`. | ||
| - If `message` is present, it's added as the `"msg"`. | ||
| - If `data` is present, it's added as the `"data"`. | ||
@@ -132,0 +132,0 @@ - If `error` is present, the `stack` property of the error is added as the |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
29115
2.19%565
1.62%