Showing content from http://svn.python.org/projects/python/branches/hoxworth-stdlib_logging-soc/test_asyncore_logging.py below:
# !/usr/bin/env python """ Test harness for the standard library logging module. """ import logging import asyncore from cStringIO import StringIO log=logging.getLogger("py.asyncore") stringLog = StringIO() # define the handler and level 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) # add the handler to the logger log.addHandler(handler) asyncore.dispatcher().log("message") print stringLog.getvalue() # For testing purposes if stringLog.getvalue() == "py.asyncore.dispatcher.hits: INFO message" + "\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