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

Handled possible case of non-bytes result from self.formatted.format #18

Merged
merged 1 commit into from
Jan 14, 2018

Conversation

rmihael
Copy link
Contributor

@rmihael rmihael commented Dec 29, 2017

I stumbled upon the problem similar to vklochan/python-logstash#30 while using python-logstash-async with https://github.com/madzak/python-json-logger on Python 3.6:

Traceback (most recent call last):
  File "/Users/rmihael/Documents/Projects/trade/python-logstash-async/logstash_async/handler.py", line 68, in emit
    data = self._format_record(record)
  File "/Users/rmihael/Documents/Projects/trade/python-logstash-async/logstash_async/handler.py", line 127, in _format_record
    return self.formatter.format(record) + b'\n'
TypeError: must be str, not bytes

Returning text type instead of bytes from format seems normal to me. Handler appears to be a proper place to handle encoding.


This change is Reviewable

@rmihael
Copy link
Contributor Author

rmihael commented Jan 8, 2018

Hi! Have you had any chance to review this PR?

@eht16
Copy link
Owner

eht16 commented Jan 10, 2018

Not yet but will do in a few days. Stay tuned, sorry for the delay.

@eht16 eht16 merged commit 163009b into eht16:master Jan 14, 2018
@eht16
Copy link
Owner

eht16 commented Jan 14, 2018

Looks good to me, thanks.

@rmihael
Copy link
Contributor Author

rmihael commented Jan 14, 2018

Great! Will you make a release with this fix anytime soon?

@eht16
Copy link
Owner

eht16 commented Jan 20, 2018

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