[FIX] removed unused imports, unused depth definition, changed indent definition

bzr revid: jba@openerp.com-20110513133514-zojsknaqrybu347e
This commit is contained in:
Jacques-Etienne Baudoux 2011-05-13 15:35:14 +02:00
parent 1ab0987803
commit 56b794c644
2 changed files with 6 additions and 8 deletions

View File

@ -20,10 +20,7 @@
##############################################################################
import time
import sys
import traceback
import logging
from pprint import pformat
from datetime import datetime
from dateutil.relativedelta import relativedelta
import netsvc
@ -95,8 +92,8 @@ class ir_cron(osv.osv, netsvc.Agent):
if m and hasattr(m, func):
f = getattr(m, func)
try:
depth=(None if self._logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1)
netsvc.log('cron', (cr.dbname,uid,'*',model,func)+tuple(args), channel=logging.DEBUG, depth=(None if self._logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='object.execute')
netsvc.log('cron', (cr.dbname,uid,'*',model,func)+tuple(args), channel=logging.DEBUG,
depth=(None if self._logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1), fn='object.execute')
f(cr, uid, *args)
except Exception, e:
cr.rollback()

View File

@ -396,10 +396,11 @@ def replace_request_password(args):
def log(title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):
logger = logging.getLogger(title)
if logger.isEnabledFor(channel):
indent=0
indent=''
indent_after=' '*len(fn)
for line in (fn+pformat(msg, depth=depth)).split('\n'):
logger.log(channel, ' '*indent+line)
indent=len(fn)
logger.log(channel, indent+line)
indent=indent_after
class OpenERPDispatcher:
def log(self, title, msg, channel=logging.DEBUG_RPC, depth=None, fn=""):