From c7e627bed96d8086f15ac9fa4517f418f2a32fd6 Mon Sep 17 00:00:00 2001 From: Stephane Wirtel Date: Wed, 10 Dec 2008 22:26:45 +0100 Subject: [PATCH] [IMP] Improve the logging bzr revid: stephane@tinyerp.com-20081210212645-01kbn7iprk88g4wn --- bin/tools/convert.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/tools/convert.py b/bin/tools/convert.py index b063c9ebabe..982d9ccdd88 100644 --- a/bin/tools/convert.py +++ b/bin/tools/convert.py @@ -486,7 +486,7 @@ form: module.record_id""" % (xml_id,) try: npid = self.pool.get('ir.model.data')._update_dummy(cr, self.uid, 'ir.ui.menu', self.module, xml_id, idx==len(m_l)-1) except: - print 'Menu Error', self.module, xml_id, idx==len(m_l)-1 + self.logger.notifyChannel('init', netsvc.LOG_ERROR, "addon: %s xml_id: %s" % (self.module, xml_id)) else: # the menuitem does't exist but we are in branch (not a leaf) self.logger.notifyChannel("init", netsvc.LOG_WARNING, 'Warning no ID for submenu %s of menu %s !' % (menu_elem, str(m_l))) @@ -738,7 +738,7 @@ form: module.record_id""" % (xml_id,) raise Exception( "Mismatch xml format: only terp or openerp as root tag" ) if de.nodeName == 'terp': - self.logger.notifyChannel("init", netsvc.LOG_WARNING, "The tag is deprecated, use ") + self.logger.notifyChannel("init", netsvc.LOG_WARNING, "The tag is deprecated, use ") for n in [i for i in de.childNodes if (i.nodeType == i.ELEMENT_NODE and i.nodeName=="data")]: for rec in n.childNodes: @@ -747,7 +747,7 @@ form: module.record_id""" % (xml_id,) try: self._tags[rec.nodeName](self.cr, rec, n) except: - self.logger.notifyChannel("init", netsvc.LOG_INFO, '\n'+rec.toxml()) + self.logger.notifyChannel("init", netsvc.LOG_ERROR, '\n'+rec.toxml()) self.cr.rollback() raise return True @@ -821,7 +821,8 @@ def convert_csv_import(cr, module, fname, csvcontent, idref=None, mode='init', try: datas.append(map(lambda x: misc.ustr(x), line)) except: - print "ERROR while importing the line: ", line + logger = netsvc.Logger() + logger.notifyChannel("init", netsvc.LOG_ERROR, "Can not import the line: %s" % line) pool.get(model).import_data(cr, uid, fields, datas,mode, module,noupdate,filename=fname_partial) if config.get('import_partial'): data = pickle.load(file(config.get('import_partial')))