@open-wa/wa-automate 4.28.0 → 4.28.1
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.
@@ -367,12 +367,12 @@ function create(config = {}) {
|
|
367
367
|
waPage.on('console', msg => {
|
368
368
|
if (config === null || config === void 0 ? void 0 : config.logConsole)
|
369
369
|
console.log(msg);
|
370
|
-
logging_1.log.info('Page Console:',
|
370
|
+
logging_1.log.info('Page Console:', msg.text());
|
371
371
|
});
|
372
372
|
waPage.on('error', error => {
|
373
373
|
if (config === null || config === void 0 ? void 0 : config.logConsoleErrors)
|
374
374
|
console.error(error);
|
375
|
-
logging_1.log.error('Page Console:',
|
375
|
+
logging_1.log.error('Page Console Error:', error.text());
|
376
376
|
});
|
377
377
|
if (config === null || config === void 0 ? void 0 : config.restartOnCrash)
|
378
378
|
waPage.on('error', (error) => __awaiter(this, void 0, void 0, function* () {
|
package/dist/logging/logging.js
CHANGED
@@ -69,12 +69,22 @@ function truncate(str, n) {
|
|
69
69
|
return str.length > n ? str.substr(0, n - 1) + '...[TRUNCATED]...' : str;
|
70
70
|
}
|
71
71
|
const formatRedact = winston.format(redact);
|
72
|
+
const stringSaver = winston.format((info) => {
|
73
|
+
const copy = (0, full_1.klona)(info);
|
74
|
+
const splat = copy[Symbol.for("splat")];
|
75
|
+
if (splat) {
|
76
|
+
copy.message = `${copy.message} ${splat.filter((x) => typeof x !== 'object').join(' ')}`;
|
77
|
+
copy[Symbol.for("splat")] = splat.filter((x) => typeof x == 'object');
|
78
|
+
return copy;
|
79
|
+
}
|
80
|
+
return info;
|
81
|
+
});
|
72
82
|
/**
|
73
83
|
* To prevent "Attempt to write logs with no transports" error
|
74
84
|
*/
|
75
85
|
const placeholderTransport = new custom_transport_1.NoOpTransport();
|
76
86
|
const makeLogger = () => winston.createLogger({
|
77
|
-
format: combine(timestamp(), winston.format.json(), formatRedact(), winston.format.splat(), winston.format.simple()),
|
87
|
+
format: combine(stringSaver(), timestamp(), winston.format.json(), formatRedact(), winston.format.splat(), winston.format.simple()),
|
78
88
|
levels: winston.config.syslog.levels,
|
79
89
|
transports: [placeholderTransport]
|
80
90
|
});
|
package/package.json
CHANGED