Thank you Glyph! Here is the issue: https://twistedmatrix.com/trac/ticket/9008
--
Kind Regards, Roman Mescheryakov
21.01.2017, 08:56, "Glyph Lefkowitz" <gl...@twistedmatrix.com>:
,On Jan 20, 2017, at 1:33 AM, Роман Мещеряков <romanmescherya...@yandex.ru> wrote:I expect the text between ‘[‘ and ‘#’ to be ‘ad_hoc’, but it is auto-generated name instead. Am I doing something wrong or this is a bug?This is indeed a bug! And a pretty serious one; it's explicitly documented to work otherwise. Please file it.The reason that this happens is that the 'namespace' field is filled out by the descriptor (__get__ method) of the `Logger` object when it is bound to `self`.You can work around this in the meanwhile by changing your example to be like so:import sysfrom twisted.logger import (Logger, textFileLogObserver)observer = textFileLogObserver(sys.stdout)class MyClass:@propertydef log(self):return Logger(namespace="ad_hoc", observer=observer, source=self)def __init__(self):self.log.info("MyClass.__init__ called!")def __del__(self):self.log.info("Bye!")obj = MyClass()-glyph_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
_______________________________________________ Twisted-Python mailing list Twisted-Python@twistedmatrix.com http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python