Skip to content

Commit cbc8bc2

Browse files
committed
refactor: remove unnecessary code
Console capture is already being setup in the main "run" script and this code is unnecessary. It was left-over from the original migration from Artillery Pro and never cleaned up.
1 parent a1658b2 commit cbc8bc2

File tree

1 file changed

+0
-60
lines changed

1 file changed

+0
-60
lines changed

packages/artillery/lib/platform/aws-ecs/legacy/run-cluster.js

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -157,66 +157,6 @@ function logProgress(msg, opts = {}) {
157157
}
158158

159159
async function tryRunCluster(scriptPath, options, artilleryReporter) {
160-
const MAX_RETAINED_LOG_SIZE_MB = Number(
161-
process.env.MAX_RETAINED_LOG_SIZE_MB || '50'
162-
);
163-
const MAX_RETAINED_LOG_SIZE = MAX_RETAINED_LOG_SIZE_MB * 1024 * 1024;
164-
165-
let currentSize = 0;
166-
// Override console.log so as not to interfere with the spinner
167-
let outputLines = [];
168-
let truncated = false;
169-
170-
console.log = (() => {
171-
const orig = console.log;
172-
return (...args) => {
173-
try {
174-
orig.apply(console, args);
175-
176-
if (currentSize < MAX_RETAINED_LOG_SIZE) {
177-
outputLines = outputLines.concat(args);
178-
for (const x of args) {
179-
currentSize += String(x).length;
180-
}
181-
} else {
182-
if (!truncated) {
183-
truncated = true;
184-
const msg = `[WARNING] Artillery: maximum retained log size exceeded, max size: ${MAX_RETAINED_LOG_SIZE_MB}MB. Further logs won't be retained.\n\n`;
185-
process.stdout.write(msg);
186-
outputLines = outputLines.concat([msg]);
187-
}
188-
}
189-
} catch (err) {
190-
debug(err);
191-
}
192-
};
193-
})();
194-
195-
console.error = (() => {
196-
const orig = console.error;
197-
return (...args) => {
198-
try {
199-
orig.apply(console, args);
200-
201-
if (currentSize < MAX_RETAINED_LOG_SIZE) {
202-
outputLines = outputLines.concat(args);
203-
for (const x of args) {
204-
currentSize += String(x).length;
205-
}
206-
} else {
207-
if (!truncated) {
208-
truncated = true;
209-
const msg = `[WARNING] Artillery: maximum retained log size exceeded, max size: ${MAX_RETAINED_LOG_SIZE_MB}MB. Further logs won't be retained.\n\n`;
210-
process.stdout.write(msg);
211-
outputLines = outputLines.concat([msg]);
212-
}
213-
}
214-
} catch (err) {
215-
debug(err);
216-
}
217-
};
218-
})();
219-
220160
global.artillery.awsRegion = (await awsGetDefaultRegion()) || options.region;
221161

222162
let context = {};

0 commit comments

Comments
 (0)