Mercurial > moin > 1.9
changeset 2993:aae2eac0894c
use 'logging' for thfcgi (port from 1.6)
author | Thomas Waldmann <tw AT waldmann-edv DOT de> |
---|---|
date | Sun, 06 Jan 2008 16:51:27 +0100 |
parents | 954c617d9f76 |
children | bbe70e8ffe62 |
files | MoinMoin/support/thfcgi.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/MoinMoin/support/thfcgi.py Sun Jan 06 16:46:47 2008 +0100 +++ b/MoinMoin/support/thfcgi.py Sun Jan 06 16:51:27 2008 +0100 @@ -11,7 +11,9 @@ Cleanup, fixed typos, PEP-8, support for limiting creation of threads, limited number of requests lifetime, configurable backlog for socket - .listen() by Thomas Waldmann <tw AT waldmann-edv DOT de> + .listen() by MoinMoin:ThomasWaldmann. + + 2007 Support for Python's logging module by MoinMoin:ThomasWaldmann. For code base see: http://cvs.lysator.liu.se/viewcvs/viewcvs.cgi/webkom/thfcgi.py?cvsroot=webkom @@ -33,7 +35,8 @@ # TODO: Compare compare the number of bytes received on FCGI_STDIN with # CONTENT_LENGTH and abort the update if the two numbers are not equal. -debug = False +import logging +LOGLEVEL = logging.DEBUG # logging.NOTSET to completely switch it off import os import sys @@ -96,12 +99,9 @@ FCGI_UnknownTypeBody = "!B7x" FCGI_EndRequestBody = "!IB3x" -LOGFILE = sys.stderr def log(s): - if debug: - LOGFILE.write(s) - LOGFILE.write('\n') + logging.log(LOGLEVEL, 'thfcgi: %s' % s) class SocketErrorOnWrite: """Is raised if a write fails in the socket code."""