[Python-checkins] r50610 - python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py
jackilyn.hoxworth
python-checkins at python.org
Thu Jul 13 00:07:21 CEST 2006
Author: jackilyn.hoxworth
Date: Thu Jul 13 00:07:20 2006
New Revision: 50610
Modified:
python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py
Log:
Still doesn't work.
Modified: python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py
==============================================================================
--- python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py (original)
+++ python/branches/hoxworth-stdlib_logging-soc/test_soc_httplib.py Thu Jul 13 00:07:20 2006
@@ -17,9 +17,14 @@
handler = logging.StreamHandler(stringLog)
log.setLevel(logging.INFO)
-# set a format for the output
-formatter = logging.Formatter('%(name)s: %(levelname)s %(message)s')
-handler.setFormatter(formatter)
+# Set up module-level logger. Found on Google, don't know if this works yet
+# console = logging.StreamHandler()
+# console.setLevel(logging.DEBUG)
+# console.setFormatter(logging.Formatter('%(asctime)s : %(message)s',
+# '%Y-%m-%d %H:%M:%S'))
+# loggerName = None
+# logging.getLogger(loggerName).addHandler(console)
+# del console
# add the handler to the logger
log.addHandler(handler)
@@ -27,8 +32,9 @@
# create socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-httplib.HTTPResponse(sock).log("message 1") # says there is no attribute for "log", wtf
-httplib.HTTPConnection(sock.connect).log("message 2")
+# httplib.HTTPResponse(sock).log("message 1") # says there is no attribute for "log"
+httplib._log.info("message 1")
+# httplib.HTTPConnection(sock.connect).log("message 2")
print stringLog.getvalue() # For testing purposes
More information about the Python-checkins
mailing list