summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Morel <xmo@openerp.com>2013-03-19 17:31:33 +0100
committerXavier Morel <xmo@openerp.com>2013-03-19 17:31:33 +0100
commitdb6b6480f7bf034ef180f382de27dc4f27a3c42e (patch)
tree479f152bef16be68da41383ea5b0ba446e6d64f8
parent5f956523d4ea67e2552c6b72e6aff3fe10bea6d3 (diff)
[IMP] switch workflows to standard logging (silenced by default), remove wkf_logs
bzr revid: xmo@openerp.com-20130319163133-3n1k1hgooddzxntz
-rw-r--r--openerp/netsvc.py1
-rw-r--r--openerp/workflow/wkf_logs.py39
-rw-r--r--openerp/workflow/workitem.py10
3 files changed, 8 insertions, 42 deletions
diff --git a/openerp/netsvc.py b/openerp/netsvc.py
index ef72ba179f2..ffbd38de36a 100644
--- a/openerp/netsvc.py
+++ b/openerp/netsvc.py
@@ -131,6 +131,7 @@ def init_logger():
# Configure handlers
default_config = [
+ 'openerp.workflow.workitem:WARNING',
'openerp.netsvc.rpc.request:INFO',
'openerp.netsvc.rpc.response:INFO',
'openerp.addons.web.http:INFO',
diff --git a/openerp/workflow/wkf_logs.py b/openerp/workflow/wkf_logs.py
deleted file mode 100644
index 9463fe61814..00000000000
--- a/openerp/workflow/wkf_logs.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 of the
-# License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-#
-# May be uncommented to logs workflows modifications
-#
-
-def log(cr,ident,act_id,info=''):
- return
- # msg = """
- #res_type: %r
- #res_id: %d
- #uid: %d
- #act_id: %d
- #info: %s
- #""" % (ident[1], ident[2], ident[0], act_id, info)
-
- #cr.execute('insert into wkf_logs (res_type, res_id, uid, act_id, time, info) values (%s,%s,%s,%s,current_time,%s)', (ident[1],int(ident[2]),int(ident[0]),int(act_id),info))
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/openerp/workflow/workitem.py b/openerp/workflow/workitem.py
index 06ba3672371..88a786e6c67 100644
--- a/openerp/workflow/workitem.py
+++ b/openerp/workflow/workitem.py
@@ -23,11 +23,13 @@
# TODO:
# cr.execute('delete from wkf_triggers where model=%s and res_id=%s', (res_type,res_id))
#
+import logging
import instance
import wkf_expr
-import wkf_logs
+
+logger = logging.getLogger(__name__)
def create(cr, act_datas, inst_id, ident, stack):
for act in act_datas:
@@ -36,7 +38,8 @@ def create(cr, act_datas, inst_id, ident, stack):
cr.execute("insert into wkf_workitem (id,act_id,inst_id,state) values (%s,%s,%s,'active')", (id_new, act['id'], inst_id))
cr.execute('select * from wkf_workitem where id=%s',(id_new,))
res = cr.dictfetchone()
- wkf_logs.log(cr,ident,act['id'],'active')
+ logger.info('Created workflow item in activity %s',
+ act['id'], extra={'ident': ident})
process(cr, res, ident, stack=stack)
def process(cr, workitem, ident, signal=None, force_running=False, stack=None):
@@ -75,7 +78,8 @@ def process(cr, workitem, ident, signal=None, force_running=False, stack=None):
def _state_set(cr, workitem, activity, state, ident):
cr.execute('update wkf_workitem set state=%s where id=%s', (state,workitem['id']))
workitem['state'] = state
- wkf_logs.log(cr,ident,activity['id'],state)
+ logger.info("Changed state of work item %s to \"%s\" in activity %s",
+ workitem['id'], state, activity['id'], extra={'ident': ident})
def _execute(cr, workitem, activity, ident, stack):
result = True