[Baypiggies] doc bug? sanity check request

K. Richard Pixley rich at noir.com
Fri Dec 10 21:44:40 CET 2010


Could someone please take a quick look at this and let me know whether 
I'm looking at a doc bug or making some other embarrassingly stupid 
mistake?  And if it is a doc bug, where should I be reporting it?

Specifically, for a dir of an instance of a logging.LogRecord, I'm seeing:

['__doc__', '__init__', '__module__', '__str__', 'args', 'created', 
'exc_info', 'exc_text', 'filename', 'funcName', 'getMessage', 
'levelname', 'levelno', 'lineno', 'module', 'msecs', 'msg', 'name', 
'pathname', 'process', 'processName', 'relativeCreated', 'thread', 
'threadName']

while the documentation lists a different set of attributes including 
"lvl": 
http://docs.python.org/library/logging.html?highlight=logging#logrecord-objects

--rich

import logging
import sys

logger = logging.getLogger('')

class Myhandler(logging.Handler):
def emit(self, record):
print >>sys.stderr, 'emit: ' + record.getMessage()
print 'dir(record) = {0}'.format(dir(record))
print >>sys.stderr, 'level: ' + record.levelname

logger.addHandler(Myhandler())

if __name__ == '__main__':
logger.setLevel(logging.DEBUG)
logger.debug('this is a test')




More information about the Baypiggies mailing list