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

Fix JSON log message escaping #376

Merged
merged 1 commit into from
Nov 21, 2021

Conversation

dnaka91
Copy link
Contributor

@dnaka91 dnaka91 commented Nov 21, 2021

Currently the JSON output for log messages breaksbecause the message is written as is.
This can produce invalid JSON when the message contains non-valid string values (like newlines) that must be scaped.

The PR replaces the manual JSON formatting in the logger setup with the serde_json::json macro, which converts string values on the fly, always producing proper JSON.

Copy link
Member

@Jake-Shadle Jake-Shadle 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 fix!

@Jake-Shadle Jake-Shadle merged commit ddde44a into EmbarkStudios:main Nov 21, 2021
@dnaka91 dnaka91 deleted the fix-json-logging branch November 21, 2021 15:10
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