From a23e063002c5ab5b9cd9d793755c981aec8e90dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 4 Jan 2019 12:45:47 +0100 Subject: [PATCH] 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. --- pillar/attrs_extra.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/pillar/attrs_extra.py b/pillar/attrs_extra.py index fd6187bc..480f5c6e 100644 --- a/pillar/attrs_extra.py +++ b/pillar/attrs_extra.py @@ -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)