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

added explicit type cast to string to FluentRecordFormatter for exclude_attrs case. #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mastak
Copy link
Contributor

@mastak mastak commented Apr 13, 2018

Case:

  1. Using FluentRecordFormatter with exclude_attrs=[].
  2. Create log record with uuid: logger.info('Some info', uuid=uuid4())
  3. 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.

@arcivanov
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants