mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Merged tweaks to cookbook example from 3.2.
This commit is contained in:
commit
e8a463d791
1 changed files with 5 additions and 5 deletions
|
@ -1597,10 +1597,10 @@ UTF-8, then you need to do the following:
|
||||||
:class:`~logging.handlers.SysLogHandler` instance, with a format string
|
:class:`~logging.handlers.SysLogHandler` instance, with a format string
|
||||||
such as::
|
such as::
|
||||||
|
|
||||||
u"ASCII section\ufeffUnicode section"
|
'ASCII section\ufeffUnicode section'
|
||||||
|
|
||||||
The Unicode code point ``u'\feff```, when encoded using UTF-8, will be
|
The Unicode code point ``'\feff```, when encoded using UTF-8, will be
|
||||||
encoded as a UTF-8 BOM -- the bytestring ``'\xef\xbb\bf'``.
|
encoded as a UTF-8 BOM -- the byte-string ``b'\xef\xbb\xbf'``.
|
||||||
|
|
||||||
#. Replace the ASCII section with whatever placeholders you like, but make sure
|
#. Replace the ASCII section with whatever placeholders you like, but make sure
|
||||||
that the data that appears in there after substitution is always ASCII (that
|
that the data that appears in there after substitution is always ASCII (that
|
||||||
|
@ -1610,8 +1610,8 @@ UTF-8, then you need to do the following:
|
||||||
which appears there after substitution is Unicode, that's fine -- it will be
|
which appears there after substitution is Unicode, that's fine -- it will be
|
||||||
encoded using UTF-8.
|
encoded using UTF-8.
|
||||||
|
|
||||||
If the formatted message is Unicode, it *will* be encoded using UTF-8 encoding
|
The formatted message *will* be encoded using UTF-8 encoding by
|
||||||
by ``SysLogHandler``. If you follow these rules, you should be able to produce
|
``SysLogHandler``. If you follow the above rules, you should be able to produce
|
||||||
RFC 5424-compliant messages. If you don't, logging may not complain, but your
|
RFC 5424-compliant messages. If you don't, logging may not complain, but your
|
||||||
messages will not be RFC 5424-compliant, and your syslog daemon may complain.
|
messages will not be RFC 5424-compliant, and your syslog daemon may complain.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue