def scope_logger ( cls ) : cls . log = logging . getLogger ( '{0}.{1}' . format ( cls . __module__ , cls . __name__ ) ) return cls
make a function that sets up a logger python
Class decorator for adding a class local logger
def scope_logger(cls):
    """
    Class decorator for adding a class local logger

    Example:
    >>> @scope_logger
    >>> class Test:
    >>>     def __init__(self):
    >>>         self.log.info("class instantiated")
    >>> t = Test()
    
    """
    cls.log = logging.getLogger('{0}.{1}'.format(cls.__module__, cls.__name__))
    return cls