I have a Python2 application which logs via the structlog library, and downstream the logs are captured an extracted using key/value syntax. However, the extraction isn't working when unicode strings are involved - the u is being prepended to unicode strings, breaking the parser.
Is it possible to configure the KeyValueRenderer to exclude the u''?
import structlog
structlog.configure(processors=[structlog.processors.KeyValueRenderer()])
l = structlog.get_logger()
l.error('I am ASCII')
l.error(u'I am Unicode')
Result:
event='I am ASCII'
event=u'I am Unicode'
Desired:
event='I am ASCII'
event='I am Unicode'
I know there are questions to change Python's global printing behavior for Unicode strings - but I'm just looking to change the behavior in structlog's approach to printing them.