@@ -228,6 +228,8 @@ class TimeoutScheduler:
228228 # use heapq functions on _handles!
229229 _handles = [] # type: List[TimeoutScheduler.Handle]
230230
231+ logger = logging .getLogger ("scapy.contrib.automotive.timeout_scheduler" )
232+
231233 @classmethod
232234 def schedule (cls , timeout , callback ):
233235 # type: (float, Callable[[], None]) -> TimeoutScheduler.Handle
@@ -316,13 +318,13 @@ def _wait(cls, handle):
316318 # Wait until the next timeout,
317319 # or until event.set() gets called in another thread.
318320 if to_wait > 0 :
319- log_isotp . debug ("TimeoutScheduler Thread going to sleep @ %f " +
320- "for %fs" , now , to_wait )
321+ cls . logger . debug ("Thread going to sleep @ %f " +
322+ "for %fs" , now , to_wait )
321323 interrupted = cls ._event .wait (to_wait )
322324 new = cls ._time ()
323- log_isotp . debug ("TimeoutScheduler Thread awake @ %f, slept for" +
324- " %f, interrupted=%d" , new , new - now ,
325- interrupted )
325+ cls . logger . debug ("Thread awake @ %f, slept for" +
326+ " %f, interrupted=%d" , new , new - now ,
327+ interrupted )
326328
327329 # Clear the event so that we can wait on it again,
328330 # Must be done before doing the callbacks to avoid losing a set().
@@ -335,7 +337,7 @@ def _task(cls):
335337 start when the first timeout is added and stop when the last timeout
336338 is removed or executed."""
337339
338- log_isotp . debug ("TimeoutScheduler Thread spawning @ %f" , cls ._time ())
340+ cls . logger . debug ("Thread spawning @ %f" , cls ._time ())
339341
340342 time_empty = None
341343
@@ -357,7 +359,7 @@ def _task(cls):
357359 finally :
358360 # Worst case scenario: if this thread dies, the next scheduled
359361 # timeout will start a new one
360- log_isotp . debug ("TimeoutScheduler Thread died @ %f" , cls ._time ())
362+ cls . logger . debug ("Thread died @ %f" , cls ._time ())
361363 cls ._thread = None
362364
363365 @classmethod
@@ -379,7 +381,7 @@ def _poll(cls):
379381 callback = handle ._cb
380382 handle ._cb = True
381383
382- # Call the callback here, outside of the mutex
384+ # Call the callback here, outside the mutex
383385 if callable (callback ):
384386 try :
385387 callback ()
0 commit comments