In OpenERP notifyChannel API shouldn't be used anymore because API is used to connect to other framework. OpenERP provide the logging module instead and it is used for any one in OpenERP server.
Use this funtion given below
def notify(self, name, level, msg):
_logger.warning(
"the standard `logging` module instead.")
from service.web_services import common
log = logging.getLogger(__name__ + '.deprecated.' + ustr(name))
if level in [LOG_TEST] and not hasattr(log, level):
fct = lambda msg, *args, **kwargs: log.log(getattr(logging, level.upper()), msg, *args, **kwargs)
setattr(log, level, fct)
level_method = getattr(log, level)
if isinstance(msg, Exception):
msg = exception_to_unicode(msg)
try:
msg = ustr(msg).strip()
if level in (LOG_ERROR, LOG_CRITICAL): # and tools.config.get_misc('debug','env_info',False):
msg = common().exp_get_server_environment() + "\n" + msg
result = msg.split('\n')
except UnicodeDecodeError:
result = msg.strip().split('\n')
try:
if len(result)>1:
for idx, s in enumerate(result):
level_method('[%02d]: %s' % (idx+1, s,))
elif result:
level_method(result[0])
except IOError:
# TODO: perhaps reset the logger streams?
pass
except Exception:
pass
0 Comment(s)