use several loggers for parts of weboob

This commit is contained in:
Romain Bignon 2010-10-30 16:09:33 +02:00
commit 84b4003bf4
14 changed files with 74 additions and 67 deletions

View file

@ -18,8 +18,8 @@
from __future__ import with_statement
import logging
from threading import Timer, Event, RLock
from weboob.tools.log import getLogger
__all__ = ['Scheduler']
@ -40,6 +40,7 @@ class IScheduler(object):
class Scheduler(IScheduler):
def __init__(self):
self.logger = getLogger('scheduler')
self.mutex = RLock()
self.stop_event = Event()
self.count = 0
@ -51,7 +52,7 @@ class Scheduler(IScheduler):
with self.mutex:
self.count += 1
logging.debug('function "%s" will be called in %s seconds' % (function.__name__, interval))
self.logger.debug('function "%s" will be called in %s seconds' % (function.__name__, interval))
timer = Timer(interval, self._callback, (self.count, function, args))
self.queue[self.count] = timer
timer.start()