On 1/3/2023 11:51 AM, Stefan Ram wrote:
Thomas Passin <li...@tompassin.net> writes:
On 1/3/2023 10:35 AM, c.bu...@posteo.jp wrote:
Also, I think it would be confusing to sometimes have logging output go
to stdout and other times go to stderr.

   In UNIX, the output of a program can be redirected,
   so error messages written to the output might get appended
   to some result file and might not be seen by the user.

Yes, and in Windows, too. Note that stderr messages can be written or redirected to a file, too, and then would not be seen on the terminal.

   Therefore, UNIX and C provide the unbuffered "stderr" stream
   that can be redirected separately.

   The following example shows how logging might write to stdout.

import logging
import sys
logging.getLogger().addHandler( logging.StreamHandler( sys.stdout ))
logging.error( 'example' )

This is starting to look too much like java.  Yuck!

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to