Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to notifychannel API and logging module instead in OpenERP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 292
    Comment on it

    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):
                "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)
                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')
                if len(result)>1:
                    for idx, s in enumerate(result):
                        level_method('[%02d]: %s' % (idx+1, s,))
                elif result:
            except IOError:
                # TODO: perhaps reset the logger streams?
            except Exception:


 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: