Antoine Pitrou added the comment:
Le 01/06/2017 à 11:28, Serhiy Storchaka a écrit :
>
> The idea LGTM. But we should first check that the logger is accessible by the
> name: getLogger(self.name) is self. The same is done when pickling classes,
> functions, etc. It shouldn't be a surprise on unpickler side.
Good idea.
> And maybe use not getLogger(), but different method which should fail if the
> logger doesn't exist rather than creating it.
I disagree. The fact that it creates a new logger if it doesn't exist is
pretty much by design. Typically, if you have:
class MyObject:
def __init__(self):
self.logger = getLogger('myobject')
then unpickling the first MyObject instance in a new process should also
create the 'myobject' logger instead of failing.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30520>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com