diff options
-rw-r--r-- | crocoite/logger.py | 6 | ||||
-rw-r--r-- | crocoite/test_logger.py | 9 |
2 files changed, 12 insertions, 3 deletions
diff --git a/crocoite/logger.py b/crocoite/logger.py index 7f4a4de..d882eaf 100644 --- a/crocoite/logger.py +++ b/crocoite/logger.py @@ -43,9 +43,9 @@ class Level(IntEnum): ERROR = 3 class Logger: - def __init__ (self, consumer=[], bindings={}): - self.bindings = bindings - self.consumer = consumer + def __init__ (self, consumer=None, bindings=None): + self.bindings = bindings or {} + self.consumer = consumer or [] def __call__ (self, level, *args, **kwargs): if not isinstance (level, Level): diff --git a/crocoite/test_logger.py b/crocoite/test_logger.py index 3af1321..26e420a 100644 --- a/crocoite/test_logger.py +++ b/crocoite/test_logger.py @@ -80,3 +80,12 @@ def test_datetime (logger): ret = logger.debug() assert 'date' in ret +def test_independence (): + """ Make sure two instances are completely independent """ + l1 = Logger () + c = QueueConsumer () + l1.connect (c) + l2 = Logger () + l2.info (nothing='nothing') + assert not c.data + |