From df3f02fcffa010db69f4d04e6d953aea24aa6e05 Mon Sep 17 00:00:00 2001 From: Philipp Muens Date: Tue, 11 Apr 2017 14:44:43 +0200 Subject: [PATCH] Show hook deprecation warnings only when SLS_DEBUG is set --- lib/classes/PluginManager.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/classes/PluginManager.js b/lib/classes/PluginManager.js index 5e87fc09f..c6d643d89 100644 --- a/lib/classes/PluginManager.js +++ b/lib/classes/PluginManager.js @@ -155,11 +155,10 @@ class PluginManager { _.forEach(pluginInstance.hooks, (hook, event) => { let target = event; const baseEvent = _.replace(event, /^(?:after:|before:)/, ''); - if (_.has(this.deprecatedEvents, baseEvent) - && pluginInstance.constructor.name !== 'ServerlessAlpha') { - this.serverless.cli.log(` -WARNING: Plugin ${pluginInstance.constructor.name} - uses deprecated hook ${event}`); + if (_.has(this.deprecatedEvents, baseEvent) && pluginName !== 'ServerlessAlpha') { + if (process.env.SLS_DEBUG) { + this.serverless.cli.log(`WARNING: Plugin ${pluginName} uses deprecated hook ${event}`); + } const redirectedEvent = this.deprecatedEvents[baseEvent]; if (redirectedEvent) { target = _.replace(event, baseEvent, redirectedEvent);