diff --git a/lib/ContainerLogger.js b/lib/ContainerLogger.js index 2fb2770..0158171 100644 --- a/lib/ContainerLogger.js +++ b/lib/ContainerLogger.js @@ -102,14 +102,21 @@ class ContainerLogger extends EventEmitter { logger.info(`Piping stdout and stderr step streams`); const stepLoggerWritableStream = this.stepLogger.writeStream(); + const { useLogsTimestamps } = this.stepLogger.opts; stepLoggerWritableStream.on('error', (err) => logger.error(`stepLoggerWritableStream: ${err}`)); // Attention(!) all streams piped to step logger writable stream must be a new streams(!) in order to avoid message piping twice to writable stream. // { end = false } on the stepLoggerWritableStream because there is only one instance of it for all the steps. this.handledStreams++; - stdout + let stdoutStream = stdout .pipe(this._logSizeLimitStream()) - .pipe(this.stepLogger.createMaskingStream()) + .pipe(this.stepLogger.createMaskingStream()); + + if (useLogsTimestamps) { + stdoutStream = stdoutStream.pipe(this.stepLogger.createPrependTimestampsStream()); + } + + stdoutStream .pipe(this.stepLogger.stepNameTransformStream().once('end', this._handleFinished.bind(this))) .pipe(stepLoggerWritableStream, { end: false }); @@ -118,10 +125,16 @@ class ContainerLogger extends EventEmitter { } this.handledStreams++; - stderr + let stderrStream = stderr .pipe(this._logSizeLimitStream()) .pipe(this._errorTransformerStream()) - .pipe(this.stepLogger.createMaskingStream()) + .pipe(this.stepLogger.createMaskingStream()); + + if (useLogsTimestamps) { + stderrStream = stderrStream.pipe(this.stepLogger.createPrependTimestampsStream()); + } + + stderrStream .pipe(this.stepLogger.stepNameTransformStream().once('end', this._handleFinished.bind(this))) .pipe(stepLoggerWritableStream, { end: false }); diff --git a/service.yaml b/service.yaml index 9712804..a8ed905 100644 --- a/service.yaml +++ b/service.yaml @@ -1 +1 @@ -version: 1.5.9 +version: 1.6.0