Files
oslo.log/oslo_log/handlers.py
Akash Gangil 92f87422ad Avoid converting to unicode if not needed
In python3, str is already represents unicode data. The current code
called oslo.utils safe_encode irrespective of incoming message encoding
and encoded it to 'utf-8', however that resolves to a byte string.

Since the syslog module expects a message of type unicode[1]. We don't
need to encode if python3 is being used, since the string representation
is sequence of unicode codepoints by default.

[1] https://hg.python.org/cpython/file/tip/Modules/syslogmodule.c#l162

Change-Id: Id40854d6b762b2d639afd7168ddb3a1e728d13d7
2016-12-05 11:08:48 -08:00

3.9 KiB