Set the log level to LOG_LEVEL env variable #417
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Set the log level to LOG_LEVEL env variable
Motivation:
LOG_LEVEL environment variable was not used
Modifications:
I made the following changes to
LambdaRuntime
log
fromlet
tovar
(I hope it does not impact Swift 6 language mode).info
when the value is incorrect or not setBy setting the log level at the creation of the runtime, before entering in the loop, I know that a change of the value in the Lambda console will not affect running microVM. Only microVM launched after the change will pick up the new value, which will eventually affect all containers as the Lambda service replaces microVM on a regular basis.
The alternative is to set the log level before each invocation of the user-provided handler. This approach would be less performant as it would require to read the environment variable at each invocation of the runtime, not only at the start.
This is a tradeoff for performance instead of flexibility.
Result:
It is now possible to write
context.logger.debug("..")
and read the line in CloudWatch logs