Don't use attr.ib to declare a logger

This doesn't work well when overriding in subclasses; it keeps using the
superclass logger. Simply returning a logger fixes this.
This commit is contained in:
2019-01-04 12:45:47 +01:00
parent 903fbf8b0d
commit a23e063002

View File

@@ -9,12 +9,8 @@ string = functools.partial(attr.ib, validator=attr.validators.instance_of(str))
def log(name): def log(name):
"""Returns a logger attr.ib """Returns a logger
:param name: name to pass to logging.getLogger() :param name: name to pass to logging.getLogger()
:rtype: attr.ib
""" """
return attr.ib(default=logging.getLogger(name), return logging.getLogger(name)
repr=False,
hash=False,
cmp=False)