@dotcom-tool-kit/logger
Advanced tools
Comparing version 4.0.0-beta.0 to 4.0.0
@@ -25,5 +25,6 @@ "use strict"; | ||
} | ||
else { | ||
if (!info.process) { | ||
// simulate the newline present in a normal console.log (which we've | ||
// removed from the Console transport) | ||
// removed from the Console transport to support logging forked | ||
// processes which don't necessarilly flush on a newline) | ||
message += '\n'; | ||
@@ -30,0 +31,0 @@ } |
@@ -12,5 +12,5 @@ "use strict"; | ||
const ansiRegexText = (0, ansi_regex_1.default)().source; | ||
const whitespaceRegex = /\s|\n/g; | ||
const startRegex = new RegExp(`^(?:(?:${ansiRegexText})|\s|\n)+`); | ||
const endRegex = new RegExp(`(?:(?:${ansiRegexText})|\s|\n)+$`); | ||
const ansiOrWhitespaceRegexText = `(?:(?:${ansiRegexText})|\\n)+`; | ||
const startRegex = new RegExp(`^${ansiOrWhitespaceRegexText}`); | ||
const endRegex = new RegExp(`${ansiOrWhitespaceRegexText}$`); | ||
// RIS escape code to effectively do a clear (^L) on the terminal. TypeScript's | ||
@@ -20,3 +20,3 @@ // watch mode does this and it's annoying to have the logs shunted around when | ||
const ansiReset = /\x1Bc/g; | ||
// Trim whitespace whilst preserving ANSI escape codes | ||
// Trim newlines whilst preserving ANSI escape codes | ||
function ansiTrim(message) { | ||
@@ -37,3 +37,3 @@ let start = 0; | ||
} | ||
return (ansiStart.replace(whitespaceRegex, '') + message.slice(start, end) + ansiEnd.replace(whitespaceRegex, '')); | ||
return ansiStart.replace('\n', '') + message.slice(start, end) + ansiEnd.replace('\n', ''); | ||
} | ||
@@ -105,4 +105,6 @@ // Remove ANSI escape codes that mess with the terminal state. This selectively | ||
// add the log level and wrap the message for the winston stream to | ||
// consume | ||
callback(null, { level, message: cleanupLogs(message) }); | ||
// consume. we preserve newlines here as, unlike other cases, this | ||
// logger can be called in the middle of a line depending on when | ||
// the stream is flushed. | ||
callback(null, { level, message: stripAnsiReset(message) }); | ||
} | ||
@@ -109,0 +111,0 @@ })) |
{ | ||
"name": "@dotcom-tool-kit/logger", | ||
"version": "4.0.0-beta.0", | ||
"version": "4.0.0", | ||
"description": "", | ||
@@ -27,3 +27,3 @@ "main": "lib", | ||
"@apaleslimghost/boxen": "^5.1.3", | ||
"@dotcom-tool-kit/error": "4.0.0-beta.0", | ||
"@dotcom-tool-kit/error": "^4.0.0", | ||
"ansi-colors": "^4.1.1", | ||
@@ -30,0 +30,0 @@ "ansi-regex": "^5.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
19586
362
1
+ Added@dotcom-tool-kit/error@4.0.0(transitive)
- Removed@dotcom-tool-kit/error@4.0.0-beta.0(transitive)