Ejemplo n.º 1
0
 def _format_debug_msg(rep_id, relevant_frames, msg):
     header = u"{}".format(rep_id)
     message = u"With message: {}".format(msg).rstrip()
     ctx_string = u"With context: {}".format(api.context_string(None))
     if len(relevant_frames) > 0:
         backtrace_json = json.dumps(relevant_frames, indent=2,
                                     separators=(",", ":"))
         backtrace_dump = backtrace_json.replace("  ", "\t")
         backtrace = u"With backtrace: {}".format(backtrace_dump)
     else:
         backtrace = ""
     return "\n".join((header, ctx_string, message, backtrace))
Ejemplo n.º 2
0
 def _format_debug_msg(rep_id, relevant_frames, msg):
     header = u"{}".format(rep_id)
     message = u"With message: {}".format(msg).rstrip()
     ctx_string = u"With context: {}".format(api.context_string(None))
     if len(relevant_frames) > 0:
         backtrace_json = json.dumps(relevant_frames,
                                     indent=2,
                                     separators=(",", ":"))
         backtrace_dump = backtrace_json.replace("  ", "\t")
         backtrace = u"With backtrace: {}".format(backtrace_dump)
     else:
         backtrace = ""
     return "\n".join((header, ctx_string, message, backtrace))
Ejemplo n.º 3
0
    def emit(self, params):
        """
        emit method, builds notification message and sends it.

        Args:
            params(dict): event content

        Returns: None
        """
        self._add_notify_time(params)
        self._event_schema.verify_event_params(self._event_id, params)
        notification = json.dumps({'jsonrpc': '2.0',
                                   'method': self._event_id,
                                   'params': params})

        self.log.debug("Sending event %s", notification)
        self._cb(notification)
Ejemplo n.º 4
0
    def emit(self, params):
        """
        emit method, builds notification message and sends it.

        Args:
            params(dict): event content

        Returns: None
        """
        self._add_notify_time(params)
        self._event_schema.verify_event_params(self._event_id, params)
        notification = json.dumps({'jsonrpc': '2.0',
                                   'method': self._event_id,
                                   'params': params})

        self.log.debug("Sending event %s", notification)
        self._cb(notification)
Ejemplo n.º 5
0
 def encode(self):
     res = self.toDict()
     return json.dumps(res)
Ejemplo n.º 6
0
 def encode(self):
     res = self.toDict()
     return json.dumps(res, 'utf-8')