@onesub/server 0.23.0 → 0.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/__tests__/logger.test.d.ts +11 -0
- package/dist/__tests__/logger.test.d.ts.map +1 -0
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/dist/logger.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -168,10 +168,16 @@ var current = console;
|
|
|
168
168
|
function setLogger(logger) {
|
|
169
169
|
if (logger) current = logger;
|
|
170
170
|
}
|
|
171
|
+
function escapeLineBreaks(value) {
|
|
172
|
+
return value.replace(/\r/g, "\\r").replace(/\n/g, "\\n").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
173
|
+
}
|
|
174
|
+
function scrub(args) {
|
|
175
|
+
return args.map((arg) => typeof arg === "string" ? escapeLineBreaks(arg) : arg);
|
|
176
|
+
}
|
|
171
177
|
var log = {
|
|
172
|
-
info: (...args) => current.info(...args),
|
|
173
|
-
warn: (...args) => current.warn(...args),
|
|
174
|
-
error: (...args) => current.error(...args)
|
|
178
|
+
info: (...args) => current.info(...scrub(args)),
|
|
179
|
+
warn: (...args) => current.warn(...scrub(args)),
|
|
180
|
+
error: (...args) => current.error(...scrub(args))
|
|
175
181
|
};
|
|
176
182
|
|
|
177
183
|
// src/http.ts
|