Davidliu 1 lună în urmă
părinte
comite
96b5ae12ed
1 a modificat fișierele cu 8 adăugiri și 6 ștergeri
  1. 8 6
      src/core/voip/bot.py

+ 8 - 6
src/core/voip/bot.py

@@ -574,16 +574,18 @@ class RandomIntVal():
         self.value = randint(0, 100000)
 
 class AsyncJob(pj.PendingJob):
-    def __init__(self):
+    def __init__(self, app):
         super().__init__()
+        self.app = app
+        self.logger = app.logger
         self.val = RandomIntVal()
-        print("Job created id:", id(self), "value:", self.val.value)
+        self.logger.warn("Job created id:", id(self), "value:", self.val.value)
 
     def execute(self, is_pending):
-        print("Executing job value:", self.val.value, is_pending)
+        self.logger.warn("Executing job value:", self.val.value, is_pending)
 
     def __del__(self):
-        print("Job deleted id:", id(self), "value:", self.val.value)
+        self.logger.warn("Job deleted id:", id(self), "value:", self.val.value)
 
 @singleton_keys
 class BotAgent:
@@ -612,9 +614,9 @@ class BotAgent:
         self.daemon_job_scheduler.start()
 
     def _add_new_job(self):
-        print("Creating job 1")
+        self.logger.warn("Creating job 1")
         job = AsyncJob()
-        print("Adding job 1")
+        self.logger.warn("Adding job 1")
         self.ep.utilAddPendingJob(job)
 
     def _create_pjsua2(self, timeout_sec=86400):