En Fri, 23 Mar 2007 19:34:31 -0300, Eric S. Johansson <[EMAIL PROTECTED]> escribió:
> class LoggedType(type): > def __new__(mcl, name, bases, classdict): > def get_logger(self): > tag = "%s.%s" % (name,sys._getframe(1).f_code.co_name) > lgr = logging.getLogger(tag) > lgr.addFilter(filter_test) > return lgr > > classdict["_%s__logger" % name] = property(get_logger) > return type.__new__(mcl, name, bases, classdict) > > It's probably real obvious but I keep getting a: > > File "C:\Python24\lib\logging\__init__.py", line 539, in filter > if not f.filter(record): > TypeError: unbound method filter() must be called with filter_test > instance as first argument (got LogRecord instance instead) I don't get all the details of what's all that stuff for, but from the error and traceback, I think you forgot to create the filter_test instance. That is, change lgr.addFilter(filter_test) to lgr.addFilter(filter_test()) -- Gabriel Genellina -- http://mail.python.org/mailman/listinfo/python-list