serverless-newrelic-lambda-layers
Advanced tools
Comparing version 3.1.0 to 3.1.1
@@ -18,4 +18,2 @@ "use strict"; | ||
const utils_1 = require("./utils"); | ||
// tslint:disable-next-line | ||
const backupLogs = require("@serverless/utils/log"); | ||
const DEFAULT_FILTER_PATTERNS = [ | ||
@@ -27,2 +25,8 @@ "REPORT", | ||
]; | ||
// The plugin uses only these log levels: | ||
const logShim = { | ||
error: console.error, | ||
warning: console.log, | ||
notice: console.log, // tslint:disable-line | ||
}; | ||
class NewRelicLambdaLayerPlugin { | ||
@@ -33,3 +37,3 @@ constructor(serverless, options, logParam) { | ||
// The run-from-lib method used by the test can't supply a log object, so this is a fallback: | ||
this.log = logParam && logParam.log ? logParam.log : backupLogs.log; | ||
this.log = logParam && logParam.log ? logParam.log : logShim; | ||
this.awsProvider = this.serverless.getProvider("aws"); | ||
@@ -187,2 +191,9 @@ this.licenseKey = null; | ||
} | ||
else if (semver.lt(version, "3.0.0")) { | ||
this.log.warning(` | ||
The Serverless logging interface changed with the release of 3.x. This plugin is compatible with Serverless 3, | ||
but may not be fully compatible with Serverless ${version}. If you have trouble deploying, we recommend that you | ||
either upgrade Serverless to >=3.0.0, or use version 2.4.1 of this plugin. | ||
`); | ||
} | ||
let plugins = _.get(this.serverless, "service.plugins", []); | ||
@@ -295,3 +306,3 @@ if (!_.isArray(plugins) && plugins.modules) { | ||
if (!this.region) { | ||
this.log.warn("No AWS region specified for NewRelic layer; skipping."); | ||
this.log.warning("No AWS region specified for NewRelic layer; skipping."); | ||
return; | ||
@@ -301,3 +312,3 @@ } | ||
if (!this.config.accountId && !environment.NEW_RELIC_ACCOUNT_ID) { | ||
this.log.warn(`No New Relic Account ID specified for "${funcName}"; skipping.`); | ||
this.log.warning(`No New Relic Account ID specified for "${funcName}"; skipping.`); | ||
return; | ||
@@ -317,3 +328,3 @@ } | ||
(wrappableRuntime && !this.config.enableExtension)) { | ||
this.log.warn(`Unsupported runtime "${runtime}" for NewRelic layer; skipping.`); | ||
this.log.warning(`Unsupported runtime "${runtime}" for NewRelic layer; skipping.`); | ||
return; | ||
@@ -333,3 +344,3 @@ } | ||
if (newRelicLayers.length) { | ||
this.log.warn(`Function "${funcName}" already specifies an NewRelic layer; skipping.`); | ||
this.log.warning(`Function "${funcName}" already specifies an NewRelic layer; skipping.`); | ||
} | ||
@@ -401,3 +412,3 @@ else { | ||
} | ||
this.log.warn(`Skipping plugin serverless-newrelic-lambda-layers for stage ${this.stage}`); | ||
this.log.warning(`Skipping plugin serverless-newrelic-lambda-layers for stage ${this.stage}`); | ||
return true; | ||
@@ -410,7 +421,7 @@ } | ||
include.indexOf(funcName) === -1) { | ||
this.log.warn(`Excluded function ${funcName}; is not part of include; skipping`); | ||
this.log.warning(`Excluded function ${funcName}; is not part of include; skipping`); | ||
return true; | ||
} | ||
if (_.isArray(exclude) && exclude.indexOf(funcName) !== -1) { | ||
this.log.warn(`Excluded function ${funcName}; skipping`); | ||
this.log.warning(`Excluded function ${funcName}; skipping`); | ||
return true; | ||
@@ -460,3 +471,3 @@ } | ||
(compatibleLayers.length < 1 && architecture)) { | ||
this.log.warn(`${architecture} is not yet supported by New Relic layers for ${runtime} in ${this.region}. Skipping.`); | ||
this.log.warning(`${architecture} is not yet supported by New Relic layers for ${runtime} in ${this.region}. Skipping.`); | ||
return false; | ||
@@ -515,3 +526,3 @@ } | ||
this.log.error(`Could not find a \`${logIngestionFunctionName}\` function installed.`); | ||
this.log.warn("Details about setup requirements are available here: https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/enable-new-relic-monitoring-aws-lambda#enable-process"); | ||
this.log.warning("Details about setup requirements are available here: https://docs.newrelic.com/docs/serverless-function-monitoring/aws-lambda-monitoring/get-started/enable-new-relic-monitoring-aws-lambda#enable-process"); | ||
if (err.providerError) { | ||
@@ -540,3 +551,3 @@ this.log.error(err.providerError.message); | ||
if (competingFilters.length) { | ||
this.log.warn("WARNING: Found a log subscription filter that was not installed by New Relic. This may prevent the New Relic log subscription filter from being installed. If you know you don't need this log subscription filter, you should first remove it and rerun this command. If your organization requires this log subscription filter, please contact New Relic at serverless@newrelic.com for assistance with getting the AWS log subscription filter limit increased."); | ||
this.log.warning("WARNING: Found a log subscription filter that was not installed by New Relic. This may prevent the New Relic log subscription filter from being installed. If you know you don't need this log subscription filter, you should first remove it and rerun this command. If your organization requires this log subscription filter, please contact New Relic at serverless@newrelic.com for assistance with getting the AWS log subscription filter limit increased."); | ||
} | ||
@@ -612,3 +623,3 @@ const existingFilters = subscriptionFilters.filter((filter) => filter.filterName === "NewRelicLogStreaming"); | ||
catch (err) { | ||
this.log.warn("Unable to create newrelic-log-ingestion function. Please verify that required environment variables have been set."); | ||
this.log.warning("Unable to create newrelic-log-ingestion function. Please verify that required environment variables have been set."); | ||
} | ||
@@ -615,0 +626,0 @@ }); |
@@ -38,3 +38,3 @@ "use strict"; | ||
if (match.length < 1) { | ||
this.log.warn("No New Relic AWS Lambda integration found for this New Relic linked account and aws account."); | ||
this.log.warning("No New Relic AWS Lambda integration found for this New Relic linked account and aws account."); | ||
if (enableIntegration && | ||
@@ -41,0 +41,0 @@ (enableIntegration !== "false" || enableIntegration !== false)) { |
{ | ||
"name": "serverless-newrelic-lambda-layers", | ||
"version": "3.1.0", | ||
"version": "3.1.1", | ||
"description": "Serverless plugin for NewRelic APM AWS Lambda layers.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
78218
1097