Skip to content
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

refactor(logger): use template literal instead of node:util format #2283

Merged
merged 2 commits into from Mar 26, 2024

Conversation

NimmLor
Copy link
Contributor

@NimmLor NimmLor commented Mar 26, 2024

Description of your changes

Updated the logging for warning message that indicates a mismatch with the Advanced Logging Controls minimum log level. Now, a template literal is used instead of the format function from the node:util package. This change addresses the sole instance where the node:util package was used, which prevented the use with LLRT.

Related issues, RFCs

Issue number: #2050

Checklist

  • My changes meet the tenets criteria
  • I have performed a self-review of my own code
  • I have commented my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my change is effective and works
  • The PR title follows the conventional commit semantics

Breaking change checklist

Is it a breaking change?: NO

  • I have documented the migration process
  • I have added, implemented necessary warnings (if it can live side by side)

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@NimmLor NimmLor requested review from a team as code owners March 26, 2024 14:30
@boring-cyborg boring-cyborg bot added the logger This item relates to the Logger Utility label Mar 26, 2024
@pull-request-size pull-request-size bot added the size/XS PR between 0-9 LOC label Mar 26, 2024
@github-actions github-actions bot added the enhancement PRs that introduce minor changes, usually to existing features label Mar 26, 2024
@NimmLor NimmLor changed the title refactor(logger): template literal instead of node:util format refactor(logger): use template literal instead of node:util format Mar 26, 2024
Copy link

sonarcloud bot commented Mar 26, 2024

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

Copy link
Contributor

@dreamorosi dreamorosi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR, I was concerned about the security of using template literals directly and opted for using the format utility but after reviewing the PR I think it should be safe to use them.

The awsLogLevel comes from the environment variable and it's set by the service, the other value (selectedLogLevel) can come from other sources but it's still validated against an allow list before being printed, so effectively we should be able to consider the two inputs safe to the extent of the rest of the code/execution environment.

@dreamorosi dreamorosi merged commit 2383c14 into aws-powertools:main Mar 26, 2024
10 checks passed
Copy link

boring-cyborg bot commented Mar 26, 2024

Awesome work, congrats on your first merged pull request and thank you for helping improve everyone's experience!

@dreamorosi dreamorosi linked an issue Mar 26, 2024 that may be closed by this pull request
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs that introduce minor changes, usually to existing features logger This item relates to the Logger Utility size/XS PR between 0-9 LOC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Support LLRT (Low Latency Runtime)
2 participants