fluent-logger-python
fluent-logger-python copied to clipboard
added explicit type cast to string to `FluentRecordFormatter` for `exclude_attrs` case.
Case:
- Using
FluentRecordFormatterwithexclude_attrs=[]. - Create log record with uuid:
logger.info('Some info', uuid=uuid4()) - catch
TypeError: can't serialize UUID('fea00603-ef79-4f11-aff5-b05ee2f68111')
msgpack has limitations for input data, so it has to be cast to simple data types.
Sorry, no. While the intention is good, you're going to be force-casting numbers and other simple types that msgpack does support into a string as well, including arrays and dicts, which is not a valid blanket conversion (people log primitive data structures via fluent all the time).
Please also see: https://github.com/msgpack/msgpack-python#packingunpacking-of-custom-data-type