From 7d19ca857230a56bbe40bda4d6704edd34019e4e Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Fri, 15 Oct 2021 10:24:09 +0200 Subject: [PATCH] refactor(CLI): Improve handling of service outputs in modern logs --- lib/plugins/aws/info/display.js | 7 +++++++ lib/plugins/aws/info/index.js | 9 +-------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/plugins/aws/info/display.js b/lib/plugins/aws/info/display.js index f6bbfccda..190349bcc 100644 --- a/lib/plugins/aws/info/display.js +++ b/lib/plugins/aws/info/display.js @@ -24,6 +24,13 @@ module.exports = { } legacy.consoleLog(message); + if (this.serverless.processedInput.commands.join(' ') === 'info') { + this.serverless.addServiceOutputSection('service', this.serverless.service.service); + this.serverless.addServiceOutputSection('stage', this.provider.getStage()); + this.serverless.addServiceOutputSection('region', this.provider.getRegion()); + this.serverless.addServiceOutputSection('stack', this.provider.naming.getStackName()); + } + return message; }, diff --git a/lib/plugins/aws/info/index.js b/lib/plugins/aws/info/index.js index fd26795d5..4d57a7069 100644 --- a/lib/plugins/aws/info/index.js +++ b/lib/plugins/aws/info/index.js @@ -1,7 +1,7 @@ 'use strict'; const BbPromise = require('bluebird'); -const { progress, writeText, style } = require('@serverless/utils/log'); +const { progress, style } = require('@serverless/utils/log'); const writeServiceOutputs = require('../../../cli/write-service-outputs'); const validate = require('../lib/validate'); const getStackInfo = require('./getStackInfo'); @@ -87,13 +87,6 @@ class AwsInfo { 'finalize': () => { if (this.serverless.processedInput.commands.join(' ') !== 'info') return; - - writeText( - `${style.aside('service:')} ${this.serverless.service.service}`, - `${style.aside('stage:')} ${this.provider.getStage()}`, - `${style.aside('region:')} ${this.provider.getRegion()}`, - `${style.aside('stack:')} ${this.provider.naming.getStackName()}` - ); writeServiceOutputs(this.serverless.serviceOutputs); }, };