I'm working on an app whose logs are formatted as JSON with a structure similar to
{"level": "INFO", "lineno": 85, "timestamp": "2020-01-01", "message": "Some message"}
This format works great in production where the logs are sent to ELK, but as the logs get more complicated it's harder understand them in PyCharm.
I'm looking for a way to format the output of the console (so I don't have to change the format of the logs in the code) to something more readable e.g.
2020-01-01 INFO 85 Some message
Looking for some solution I found this option that uses bunyan and also a suggestion to use GrepConsole. I didn't manage to make either of them work.
The bunyan solution simply didn't work. The logs kept showing as JSON and GrepConsole is great for filtering or highlighting some text, but not for manipulations.
Any ideas would be greatly appreciated.
Since python3.11, the new stack trace gets even more complex when using json-formatter.
However, Pycharm has added a small "soft-wrap" option which will expand the json to full size:
This:

Turns into this:

Hope it can help.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With