refactor(CLI): Improve handling of service outputs in modern logs

This commit is contained in:
Mariusz Nowak 2021-10-15 10:24:09 +02:00 committed by Mariusz Nowak
parent f4163d2571
commit 7d19ca8572
2 changed files with 8 additions and 8 deletions

View File

@ -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;
},

View File

@ -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);
},
};