Skip to content

Conversation

heitorlessa
Copy link
Contributor

Issue number: #3474

Summary

This PR ensures default json.dumps used by Logger prints non-ascii values as-is instead of escaping them.

Changes

Please provide a summary of what's being changed

User experience

Please share what the user experience looks like before and after this change

from aws_lambda_powertools import Logger

logger = Logger()

japanese_string = "\u30b9\u30b3\u30d3\u30eb\u30c7\u30e2\uff12"

logger.info(japanese_string)

Output

{
    "level": "INFO",
    "location": "<module>:21",
    "message": "スコビルデモ2",
    "timestamp": "2023-12-08 17:17:50,933+0100",
    "service": "service_undefined"
}

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

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.

Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
Signed-off-by: heitorlessa <lessa@amazon.co.uk>
@heitorlessa heitorlessa requested a review from a team December 8, 2023 16:18
@pull-request-size pull-request-size bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 8, 2023
@codecov-commenter
Copy link

codecov-commenter commented Dec 8, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (fa8ce4e) 95.43% compared to head (e2f0d57) 95.43%.
Report is 9 commits behind head on develop.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3475   +/-   ##
========================================
  Coverage    95.43%   95.43%           
========================================
  Files          209      209           
  Lines         9675     9675           
  Branches      1774     1774           
========================================
  Hits          9233     9233           
  Misses         329      329           
  Partials       113      113           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@heitorlessa heitorlessa marked this pull request as draft December 8, 2023 16:25
@heitorlessa heitorlessa marked this pull request as ready for review December 11, 2023 13:49
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
3.0% 3.0% Duplication

Copy link
Contributor

@leandrodamascena leandrodamascena left a comment

Choose a reason for hiding this comment

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

LGTM!

@leandrodamascena leandrodamascena merged commit 419e05b into aws-powertools:develop Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
logger size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: AWS Powertools Logger does not display utf-8 encoded (e.g. Japanese) characters consistently with print() or native logging library
3 participants