Skip to content

Conversation

@k8scat
Copy link
Contributor

@k8scat k8scat commented Nov 14, 2025

feat: #170

@cla-checker-service
Copy link

cla-checker-service bot commented Nov 14, 2025

💚 CLA has been signed

@github-actions
Copy link

🤖 GitHub comments

Just comment with:

  • run docs-build : Re-trigger the docs validation. (use unformatted text in the comment!)

@k8scat
Copy link
Contributor Author

k8scat commented Nov 14, 2025

run docs-build

Copy link
Member

@xrmx xrmx 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, haven't looked closely at the code but this needs some tests and some docs update in docs/setup.asciidoc in order to be merged.

…Formatter` and `StructlogFormatter` to control non-ASCII character escaping. Update documentation and add tests to verify behavior for different `ensure_ascii` values.
@github-actions
Copy link

github-actions bot commented Nov 19, 2025

🔍 Preview links for changed docs

@k8scat
Copy link
Contributor Author

k8scat commented Nov 19, 2025

Thanks for the PR, haven't looked closely at the code but this needs some tests and some docs update in docs/setup.asciidoc in order to be merged.

Thanks for the feedback! I've addressed both points:

Tests Added

I've added comprehensive test coverage for the ensure_ascii parameter:

For StdlibFormatter (5 new tests in tests/test_stdlib_formatter.py):

  • Tests for default behavior (ensure_ascii=True)
  • Tests for explicit True/False values
  • Tests with emojis and Unicode characters (Chinese, etc.)
  • Tests with extra fields containing non-ASCII characters

For StructlogFormatter (5 new tests in tests/test_structlog_formatter.py):

  • Similar comprehensive coverage for the structlog formatter
  • All tests verify both the JSON output format and correct parsing

All tests verify that:

  • Non-ASCII characters are properly escaped when ensure_ascii=True (default)
  • Non-ASCII characters are preserved when ensure_ascii=False
  • The output is always valid JSON

Documentation Updated

I've added documentation to docs/reference/installation.md (note: this project uses markdown docs rather than asciidoc). The documentation includes:

  • A new section "Controlling ASCII encoding" for StdlibFormatter
  • A new section "Controlling ASCII encoding for Structlog" for StructlogFormatter
  • Code examples showing both default and custom behavior
  • Explanation of use cases for internationalized applications

Please let me know if you'd like any changes or have additional feedback!

basepi
basepi previously approved these changes Nov 21, 2025
Copy link
Contributor

@basepi basepi left a comment

Choose a reason for hiding this comment

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

Looks great. Thanks for adding docs and tests!

@k8scat
Copy link
Contributor Author

k8scat commented Nov 24, 2025

Looks great. Thanks for adding docs and tests!

Thanks! I've also reformatted the code to ensure consistency. The changes are now ready for review.

@xrmx xrmx merged commit 908d4e4 into elastic:main Nov 24, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants