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

use inspect instead of json.stringify when logging object #5482

Open
wants to merge 2 commits into from

Conversation

RodgeFu
Copy link
Contributor

@RodgeFu RodgeFu commented Jan 3, 2025

use inspect instead of json.stringify when logging object

@RodgeFu RodgeFu added the ide Issues for VS, VSCode, Monaco, etc. label Jan 3, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot added the compiler:core Issues for @typespec/compiler label Jan 3, 2025
@azure-sdk
Copy link
Collaborator

azure-sdk commented Jan 3, 2025

All changed packages have been documented.

  • @typespec/compiler
Show changes

@typespec/compiler - internal ✏️

Use inspect() instead of JSON.stringify() when logging object

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs 🛝 VSCode Extension

Copy link
Member

@chrisradek chrisradek left a comment

Choose a reason for hiding this comment

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

I don't have any real objections - just curious what motivated making this change.

@RodgeFu
Copy link
Contributor Author

RodgeFu commented Jan 7, 2025

I don't have any real objections - just curious what motivated making this change.

It's because json.stringify doesn't work well when the object to log is complex. Notice it when troubleshooting an exception because of incompatibility and the json.stringify failed to log the error, so update to use inspect. Thanks.

@RodgeFu RodgeFu added this pull request to the merge queue Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler:core Issues for @typespec/compiler ide Issues for VS, VSCode, Monaco, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants