Hi there!
First of all, I want to say that I really like this plugin, and it has been helping me to reduce lots of cold starts on some of the projects I've been working on.
But recently, I've been facing some extra costs related to some console.logs set up on the warmup lambda. The cost has been increasing as much as we deploy and create new environments.
I have three proposals to sort this out:
Disabling console.logs by default. This might have been generating extra costs for other projects, and could be good to only turn on the logs for debugging reasons. It would be solved by creating a logger function like this:
const logger = str => if (process.env.ENABLE_WARMUP_LOGS === 'true') console.log(str);
And replacing all the console.logs with it. The logs could be enabled with the environment variable ENABLE_WARMUP_LOGS having its value equal to true.
Start using the debug package. This approach would be really good for projects that already use debug because it would only log to the console if the project is with the variable DEBUG=serverless-plugin-warmup:*. Besides, would be easier to get used to projects that do not use debug.
Set an environment variable, but disable the logs instead of enabling it. This way the default behavior would be having the logs, but it gives the change of disabling it if the user wants. The logger function would be something like:
const logger = str => if (process.env.DISABLE_WARMUP_LOGS !== 'true') console.log(str);
Either way, I believe the default behavior for this plugin shouldn't have any logs, and the first proposal seems to be the better one :smile:.
Hi there! First of all, I want to say that I really like this plugin, and it has been helping me to reduce lots of cold starts on some of the projects I've been working on.
But recently, I've been facing some extra costs related to some
console.logs
set up on the warmup lambda. The cost has been increasing as much as we deploy and create new environments.I have three proposals to sort this out:
Disabling
console.logs
by default. This might have been generating extra costs for other projects, and could be good to only turn on the logs for debugging reasons. It would be solved by creating a logger function like this:And replacing all the
console.logs
with it. The logs could be enabled with the environment variableENABLE_WARMUP_LOGS
having its value equal to true.Start using the debug package. This approach would be really good for projects that already use debug because it would only log to the console if the project is with the variable
DEBUG=serverless-plugin-warmup:*
. Besides, would be easier to get used to projects that do not use debug.Set an environment variable, but disable the logs instead of enabling it. This way the default behavior would be having the logs, but it gives the change of disabling it if the user wants. The logger function would be something like:
Either way, I believe the default behavior for this plugin shouldn't have any logs, and the first proposal seems to be the better one :smile:.