Skip to content

Commit a1658b2

Browse files
committed
fix: revert changes made in b31e5ce
The changes broke Artillery Cloud integration: - Tests producing a lot of console output would fail when trying to send logs to Artillery Cloud, e.g. [1] - Text was not being reconstructed correctly 1. https://github.com/artilleryio/artillery/actions/runs/19301354869/job/55196979438?pr=3653#step:11:1017
1 parent 4f27ffc commit a1658b2

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

packages/artillery/lib/console-capture.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const debug = require('debug')('console-capture');
2-
const _sleep = require('./util/sleep');
32

43
function setupConsoleCapture() {
54
let outputLines = [];
@@ -41,13 +40,13 @@ function setupConsoleCapture() {
4140

4241
console.log = (() => {
4342
const orig = console.log;
44-
return (...args) => {
43+
return () => {
4544
try {
46-
orig.apply(console, args);
45+
orig.apply(console, arguments);
4746

4847
if (currentSize < MAX_RETAINED_LOG_SIZE) {
49-
outputLines = outputLines.concat(args);
50-
for (const x of args) {
48+
outputLines = outputLines.concat(arguments);
49+
for (const x of arguments) {
5150
currentSize += String(x).length;
5251
}
5352
} else {
@@ -66,13 +65,13 @@ function setupConsoleCapture() {
6665

6766
console.error = (() => {
6867
const orig = console.error;
69-
return (...args) => {
68+
return () => {
7069
try {
71-
orig.apply(console, args);
70+
orig.apply(console, arguments);
7271

7372
if (currentSize < MAX_RETAINED_LOG_SIZE) {
74-
outputLines = outputLines.concat(args);
75-
for (const x of args) {
73+
outputLines = outputLines.concat(arguments);
74+
for (const x of arguments) {
7675
currentSize += String(x).length;
7776
}
7877
} else {
@@ -90,4 +89,4 @@ function setupConsoleCapture() {
9089
})();
9190
}
9291

93-
module.exports = setupConsoleCapture;
92+
module.exports = setupConsoleCapture;

packages/artillery/lib/platform/cloud/cloud.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ class ArtilleryCloudPlugin {
135135
console.log(stringifyErr);
136136
}
137137
for (const args of lines) {
138-
text += `${util.format(...Object.keys(args).map((k) => args[k]))}\n`;
138+
text += util.format(...Object.keys(args).map((k) => args[k])) + '\n';
139139
}
140140

141141
try {

0 commit comments

Comments
 (0)