Skip to content

Commit

Permalink
refactor(CLI): Improve handling of service outputs in modern logs
Browse files Browse the repository at this point in the history
  • Loading branch information
medikoo committed Oct 15, 2021
1 parent f4163d2 commit 7d19ca8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 7 additions & 0 deletions lib/plugins/aws/info/display.js
Expand Up @@ -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;
},

Expand Down
9 changes: 1 addition & 8 deletions 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');
Expand Down Expand Up @@ -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);
},
};
Expand Down

0 comments on commit 7d19ca8

Please sign in to comment.