tintoy / seqlog

Python logging integration for Seq (https://getseq.net)
https://seqlog.readthedocs.io/
MIT License
16 stars 11 forks source link

changes best_effort_json_encode to do not convert json to string #59

Closed kajedot closed 1 year ago

kajedot commented 1 year ago

When I was testing sending JSONs in arguments, I found out that everything is converted to the string. In consequence Seq, is interpreting JSON structures as a plain text. In this situation, we are loosing Seq features related to handling JSON data, like easy querying on JSON fields, folding, coloring etc. Therefore I changed best_effort_json_encode function. Now it is checking if a given parameter is a JSON object, and if it is, then it does not convert it to a string. If given argument is not a proper JSON structure (json.dumps throw TypeError), then it converts it to a string like it was before.

Before: image

After: image

I also added JSON objects to arguments in tests.

tintoy commented 1 year ago

Thanks!

I'll publish a new package tomorrow morning 🙂