Skip to content

Map LOG_LEVEL to new aws powertools log level variables. #93

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

paultop6
Copy link
Contributor

No description provided.

@paultop6 paultop6 requested a review from a team as a code owner November 22, 2023 13:44
@dxd1
Copy link
Contributor

dxd1 commented Nov 22, 2023

It't a good idea but would it make sense to expect them to be set and fall back to LOG_LEVEL only if not?

@paultop6
Copy link
Contributor Author

It't a good idea but would it make sense to expect them to be set and fall back to LOG_LEVEL only if not?

I dont quite follow what you mean?

Not every services sets LOG_LEVEL, so it would make sense to have it conditionally map it to the new log level variables only if LOG_LEVEL has itself been set.

@dxd1
Copy link
Contributor

dxd1 commented Nov 22, 2023

What I mean is that this way they will get overwitten if LOG_LEVEL is set.

@paultop6
Copy link
Contributor Author

What I mean is that this way they will get overwitten if LOG_LEVEL is set.

That should be the intention. https://linear.app/epsy/issue/BE-810/%5Bserverless-builder%5D-support-for-new-env-variables-used-by-aws-lambda

@dxd1
Copy link
Contributor

dxd1 commented Nov 22, 2023

This way we need to support a deprecated env var and we can't separate the 2 if we want to. Would something like this make sense?

 if "LOG_LEVEL" in self.envs:
            self.envs["AWS_LAMBDA_LOG_LEVEL"] = self.envs.get("AWS_LAMBDA_LOG_LEVEL", self.envs["LOG_LEVEL"])
            self.envs["POWERTOOLS_LOG_LEVEL"] = self.envs.get("POWERTOOLS_LOG_LEVEL", self.envs["LOG_LEVEL"])

This way we only owerride the values if they're not already set

@paultop6
Copy link
Contributor Author

This way we need to support a deprecated env var and we can't separate the 2 if we want to. Would something like this make sense?

 if "LOG_LEVEL" in self.envs:
            self.envs["AWS_LAMBDA_LOG_LEVEL"] = self.envs.get("AWS_LAMBDA_LOG_LEVEL", self.envs["LOG_LEVEL"])
            self.envs["POWERTOOLS_LOG_LEVEL"] = self.envs.get("POWERTOOLS_LOG_LEVEL", self.envs["LOG_LEVEL"])

This way we only owerride the values if they're not already set

Ok I understand what you mean now.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants