Showing content from http://svn.python.org/projects/python/branches/hoxworth-stdlib_logging-soc/test_ihooks_logging.py below:
import shlex import logging from cStringIO import StringIO # ... run the tests ... log=logging.getLogger("py.shlex") stringLog = StringIO() # define the handler and level handler = logging.StreamHandler(stringLog) log.setLevel(logging.INFO) # add the handler to the logger log.addHandler(handler) shlex._log.info("message 1") print stringLog.getvalue() # For testing purposes if stringLog.getvalue() == "message 1" + "\n": print "it worked" else: print "it didn't work"
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4