Hello
In the attached case I replace the logging module's standard logger class,
using logging.setLoggerClass, which confuses PyLint, since it thinks my
logger objects are still of the standard type. Can I in my get_logger
function somehow tell PyLint that an object of the type test.Logger is
returned?
E: 20: Instance of 'RootLogger' has no 'info2' member (but some types could
not be inferred)
E: 20: Instance of 'Logger' has no 'info2' member (but some types could not
be inferred)
Thanks,
Arve Knudsen
import logging
class Logger(logging.Logger):
# Alias 'debug' for consistency
debug1 = logging.Logger.debug
def debug2(self, message, *args, **kwds):
"""Log message with level DEBUG-1."""
self.log(logging.DEBUG-1, message, *args, **kwds)
# Alias 'info' for consistency
info1 = logging.Logger.info
def info2(self, message, *args, **kwds):
"""Log message with level INFO-1."""
self.log(logging.INFO-1, message, *args, **kwds)
def get_logger(name):
return logging.getLogger(name)
logging.setLoggerClass(Logger)
logger = get_logger('test')
logger.info2('testing')
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects