[FIX] delivery: Added ondelete attribut on fields grid_id in Grid Line
[odoo/odoo.git] / bin / netsvc.py
index d137527..c2360ae 100644 (file)
@@ -309,7 +309,7 @@ class Agent(object):
     """
     __tasks = []
     __tasks_by_db = {}
-    _logger = Logger()
+    _logger = logging.getLogger('netsvc.agent')
 
     @classmethod
     def setAlarm(cls, function, timestamp, db_name, *args, **kwargs):
@@ -320,6 +320,7 @@ class Agent(object):
     @classmethod
     def cancel(cls, db_name):
         """Cancel all tasks for a given database. If None is passed, all tasks are cancelled"""
+        cls._logger.debug("Cancel timers for %s db", db_name or 'all')
         if db_name is None:
             cls.__tasks, cls.__tasks_by_db = [], {}
         else:
@@ -334,7 +335,7 @@ class Agent(object):
     @classmethod
     def runner(cls):
         """Neverending function (intended to be ran in a dedicated thread) that
-           checks every 60 seconds tasks to run.
+           checks every 60 seconds tasks to run. TODO: make configurable
         """
         current_thread = threading.currentThread()
         while True:
@@ -346,7 +347,7 @@ class Agent(object):
                     # null timestamp -> cancelled task
                     continue
                 current_thread.dbname = dbname   # hack hack
-                cls._logger.notifyChannel('timers', LOG_DEBUG, "Run %s.%s(*%r, **%r)" % (function.im_class.__name__, function.func_name, args, kwargs))
+                cls._logger.debug("Run %s.%s(*%s, **%s)", function.im_class.__name__, function.func_name, args, kwargs)
                 delattr(current_thread, 'dbname')
                 task_thread = threading.Thread(target=function, name='netsvc.Agent.task', args=args, kwargs=kwargs)
                 # force non-daemon task threads (the runner thread must be daemon, and this property is inherited by default)
@@ -362,7 +363,6 @@ agent_runner = threading.Thread(target=Agent.runner, name="netsvc.Agent.runner")
 agent_runner.setDaemon(True)
 agent_runner.start()
 
-
 import traceback
 
 class Server:
@@ -473,10 +473,10 @@ def replace_request_password(args):
     return args
 
 class OpenERPDispatcher:
-    def log(self, title, msg, channel=logging.DEBUG_RPC, depth=2):
+    def log(self, title, msg, channel=logging.DEBUG_RPC, depth=None):
         logger = logging.getLogger(title)
         if logger.isEnabledFor(channel):
-            for line in pformat(msg, depth=100).split('\n'):
+            for line in pformat(msg, depth=depth).split('\n'):
                 logger.log(channel, line)
 
     def dispatch(self, service_name, method, params):
@@ -484,10 +484,10 @@ class OpenERPDispatcher:
             logger = logging.getLogger('result')
             self.log('service', service_name)
             self.log('method', method)
-            self.log('params', replace_request_password(params), depth=(logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) and 3 or 1))
+            self.log('params', replace_request_password(params), depth=(None if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1))
             auth = getattr(self, 'auth_provider', None)
             result = ExportService.getService(service_name).dispatch(method, auth, params)
-            self.log('result', result, channel=logging.DEBUG_RPC_ANSWER, depth=(logger.isEnabledFor(logging.DEBUG_SQL) and 5 or 3))
+            self.log('result', result, channel=logging.DEBUG_RPC_ANSWER)
             return result
         except Exception, e:
             self.log('exception', tools.exception_to_unicode(e))