[IMP] tools: removed deprecated debug() function.

bzr revid: vmt@openerp.com-20120118114910-xrynwguzu0e5zsng
This commit is contained in:
Vo Minh Thu 2012-01-18 12:49:10 +01:00
parent 8c3daeea12
commit a236a3ac75
1 changed files with 0 additions and 34 deletions

View File

@ -731,40 +731,6 @@ class profile(object):
return wrapper
def debug(what):
"""
This method allow you to debug your code without print
Example:
>>> def func_foo(bar)
... baz = bar
... debug(baz)
... qnx = (baz, bar)
... debug(qnx)
...
>>> func_foo(42)
This will output on the logger:
[Wed Dec 25 00:00:00 2008] DEBUG:func_foo:baz = 42
[Wed Dec 25 00:00:00 2008] DEBUG:func_foo:qnx = (42, 42)
To view the DEBUG lines in the logger you must start the server with the option
--log-level=debug
"""
warnings.warn("The tools.debug() method is deprecated, please use logging.",
DeprecationWarning, stacklevel=2)
from inspect import stack
from pprint import pformat
st = stack()[1]
param = re.split("debug *\((.+)\)", st[4][0].strip())[1].strip()
while param.count(')') > param.count('('): param = param[:param.rfind(')')]
what = pformat(what)
if param != what:
what = "%s = %s" % (param, what)
logging.getLogger(st[3]).debug(what)
__icons_list = ['STOCK_ABOUT', 'STOCK_ADD', 'STOCK_APPLY', 'STOCK_BOLD',
'STOCK_CANCEL', 'STOCK_CDROM', 'STOCK_CLEAR', 'STOCK_CLOSE', 'STOCK_COLOR_PICKER',
'STOCK_CONNECT', 'STOCK_CONVERT', 'STOCK_COPY', 'STOCK_CUT', 'STOCK_DELETE',