Files
pillar/pillar/attrs_extra.py
Sybren A. Stüvel a23e063002 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.
2019-01-04 12:45:47 +01:00

17 lines
302 B
Python

"""Extra functionality for attrs."""
import functools
import logging
import attr
string = functools.partial(attr.ib, validator=attr.validators.instance_of(str))
def log(name):
"""Returns a logger
:param name: name to pass to logging.getLogger()
"""
return logging.getLogger(name)