Commit 17fc0ef9 authored by Julien Muchembled's avatar Julien Muchembled

logger: new _setup() method to setup the logger when lock is already acquired

This commit only moves code from setup() to _setup()
parent 88c0d6f5
...@@ -135,8 +135,7 @@ class NEOLogger(Logger): ...@@ -135,8 +135,7 @@ class NEOLogger(Logger):
while max_size < self._record_size: while max_size < self._record_size:
self._record_size -= RECORD_SIZE + len(q.popleft().msg) self._record_size -= RECORD_SIZE + len(q.popleft().msg)
def setup(self, filename=None, reset=False): def _setup(self, filename=None, reset=False):
with self:
from . import protocol as p from . import protocol as p
global uuid_str global uuid_str
uuid_str = p.uuid_str uuid_str = p.uuid_str
...@@ -188,6 +187,10 @@ class NEOLogger(Logger): ...@@ -188,6 +187,10 @@ class NEOLogger(Logger):
else: else:
with self._db: with self._db:
q("INSERT INTO protocol VALUES (?,?)", (time(), p)) q("INSERT INTO protocol VALUES (?,?)", (time(), p))
def setup(self, filename=None, reset=False):
with self:
self._setup(filename, reset)
__del__ = setup __del__ = setup
def isEnabledFor(self, level): def isEnabledFor(self, level):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment