diff --git a/contrib/opencensus-ext-azure/opencensus/ext/azure/log_exporter/__init__.py b/contrib/opencensus-ext-azure/opencensus/ext/azure/log_exporter/__init__.py index 14e228d06..ac1d5300c 100644 --- a/contrib/opencensus-ext-azure/opencensus/ext/azure/log_exporter/__init__.py +++ b/contrib/opencensus-ext-azure/opencensus/ext/azure/log_exporter/__init__.py @@ -41,6 +41,27 @@ __all__ = ['AzureEventHandler', 'AzureLogHandler'] +class DummyLock: + """ + Implements the threading.Lock interface and do nothing + """ + + def __enter__(self): + return self + + def __exit__(self, *args): + return self + + def acquire(self, *args, **kwargs): + pass + + def release(self): + pass + + def _at_fork_reinit(self): + pass + + class BaseLogHandler(logging.Handler): def __init__(self, **options): @@ -103,7 +124,8 @@ def close(self, timeout=None): super(BaseLogHandler, self).close() def createLock(self): - self.lock = None + # not synchronising handling + self.lock = DummyLock() def emit(self, record): self._queue.put(record, block=False)