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:
parent
903fbf8b0d
commit
a23e063002
@ -9,12 +9,8 @@ string = functools.partial(attr.ib, validator=attr.validators.instance_of(str))
|
||||
|
||||
|
||||
def log(name):
|
||||
"""Returns a logger attr.ib
|
||||
"""Returns a logger
|
||||
|
||||
:param name: name to pass to logging.getLogger()
|
||||
:rtype: attr.ib
|
||||
"""
|
||||
return attr.ib(default=logging.getLogger(name),
|
||||
repr=False,
|
||||
hash=False,
|
||||
cmp=False)
|
||||
return logging.getLogger(name)
|
||||
|
Loading…
x
Reference in New Issue
Block a user