Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
vasil-cf committed Dec 19, 2024
1 parent 86e84f8 commit 3aa383d
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion lib/ContainerLogger.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ class ContainerLogger extends EventEmitter {
// { end = false } on the stepLoggerWritableStream because there is only one instance of it for all the steps.
this.handledStreams++;
let stdoutStream = stdout
.pipe(this._interceptDeprecatedImagesStream())
.pipe(this._logSizeLimitStream())
.pipe(this.stepLogger.createMaskingStream());

Expand All @@ -148,6 +149,7 @@ class ContainerLogger extends EventEmitter {

this.handledStreams++;
let stderrStream = stderr
.pipe(this._interceptDeprecatedImagesErrorStream())
.pipe(this._logSizeLimitStream())
.pipe(this._errorTransformerStream())
.pipe(this.stepLogger.createMaskingStream());
Expand Down Expand Up @@ -182,7 +184,11 @@ class ContainerLogger extends EventEmitter {
this.handledStreams++;
stream.on('end', this._handleFinished.bind(this));
stream.on('data', (chunk) => {
this._logMessage(Buffer.from(chunk).toString('utf-8'), isError);
const message = Buffer.from(chunk).toString('utf-8');
if (message.startsWith('[DEPRECATION NOTICE]')) {
logger.info(`VASIL, _handleTtyStream: ${message}`);
}
this._logMessage(message, isError);
});
logger.info(`Listening on stream 'data' event for container: ${this.containerId}`);
}
Expand Down Expand Up @@ -233,6 +239,30 @@ class ContainerLogger extends EventEmitter {
this.emit('message.logged', curLogSize);
}

_interceptDeprecatedImagesStream() {
return new Transform({
transform: (data, encoding, done) => {
const message = data.toString('utf8');
if (message.startsWith('[DEPRECATION NOTICE]')) {
logger.info(`VASIL: ${message}`);
}
done(null, data);
}
});
}

_interceptDeprecatedImagesErrorStream() {
return new Transform({
transform: (data, encoding, done) => {
const message = data.toString('utf8');
if (message.startsWith('[DEPRECATION NOTICE]')) {
logger.info(`VASIL, stderr: ${message}`);
}
done(null, data);
}
});
}

_errorTransformerStream() {
return new Transform({
transform: (data, encoding, done) => {
Expand Down

0 comments on commit 3aa383d

Please sign in to comment.