[issue28294] HTTPServer server.py assumes sys.stderr != None

Guido van Rossum report at bugs.python.org
Sat Oct 1 11:35:33 EDT 2016


Guido van Rossum added the comment:

A problem with switching to logging is the API design.

There are three functions, log_request(), log_error() and
log_message(). The former two call the latter. The API explicitly
encourages overriding log_message() to customize logging. But it has
no way to know whether it's called from log_error(), log_request(), or
directly.

So how is it to choose logging levels? I imagine log_request() should
log at the INFO level, log_error() at the ERROR level, and let's say
that direct calls to log_message() should also log at the INFO level
(from looking at the few calls). So how should log_error() distinguish
itself to log_message() without breaking apps that override the
latter?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28294>
_______________________________________


More information about the Python-bugs-list mailing list