Skip to content
This repository has been archived by the owner on Jul 14, 2021. It is now read-only.

support unicode in log messages #1293

Open
valentin-krasontovitsch opened this issue Jan 25, 2018 · 0 comments
Open

support unicode in log messages #1293

valentin-krasontovitsch opened this issue Jan 25, 2018 · 0 comments

Comments

@valentin-krasontovitsch

When getting logs from a golang webserver
which reports response times in microseconds
I get the following error message

UnicodeEncodeError: 'ascii' codec can't encode character u'\xb5' in position 47: \
ordinal not in range(128)

Please add support for unicode - I personally think it should not be assumed that messaged will always be written in ascii. I will gladly submit a merge request if someone could guide me in the right direction.

Full stacktrace:

Traceback (most recent call last):
  File "/usr/local/bin/bonfire", line 11, in <module>
    load_entry_point('bonfire', 'console_scripts', 'bonfire')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/tmp/src/bonfire/bonfire/cli.py", line 200, in run
    run_logprint(gl_api, q, formatter, follow, interval, latency, output)
  File "/tmp/src/bonfire/bonfire/output.py", line 38, in run_logprint
    formatted_msgs = [formatter(m) for m in result.messages]
  File "/tmp/src/bonfire/bonfire/formats.py", line 75, in format
    return timestamp + ";" + ";".join(map(lambda f: "'{val}'".format(val=entry.message_dict.get(f, "")), fields))
  File "/tmp/src/bonfire/bonfire/formats.py", line 75, in <lambda>
    return timestamp + ";" + ";".join(map(lambda f: "'{val}'".format(val=entry.message_dict.get(f, "")), fields))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xb5' in position 47: ordinal not in range(128)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant