cleared up a lot of boilerplate with lazy properties

This commit is contained in:
Rudi Grinberg 2012-07-13 11:28:16 -04:00
parent 309b071142
commit 120305f383
7 changed files with 53 additions and 34 deletions

View file

@ -1,12 +1,14 @@
import logging
import abc
from media.monitor.pure import LazyProperty
logger = logging.getLogger('mediamonitor2')
logging.basicConfig(filename='/home/rudi/throwaway/mm2.log', level=logging.DEBUG)
class Loggable(object):
__metaclass__ = abc.ABCMeta
@property
# TODO : replace this boilerplate with LazyProperty
@LazyProperty
def logger(self):
if not hasattr(self,"_logger"): self._logger = logging.getLogger('mediamonitor2')
return self._logger