cleared up a lot of boilerplate with lazy properties
This commit is contained in:
parent
206027073c
commit
6b9cf85fc5
7 changed files with 53 additions and 34 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue