nhairs / python-json-logger

JSON Formatter for Python Logging
https://nhairs.github.io/python-json-logger/
BSD 2-Clause "Simplified" License
28 stars 5 forks source link

Improve non-standard type encoding #12

Closed nhairs closed 5 months ago

nhairs commented 6 months ago

This PR improves the JSON encoding of non-standard types by introducing and using the .defaults module. The .defaults module adds helper functions that can test and apply formatting for types not supported by a given encoder.

Please note that in doing so, some outputs of the JsonFormatter have changed. That said these changes return more "reasonable" results rather the the original str(o) fallback.

For more detailed list of changes to the encoders see the CHANGELOG.

Test Plan

Have added additional tests and now check for specific output.