def get_with_name(self, name=None): if not name: name = self._current if not name: raise AssertionError(self._miss_error) logger.debug("Choosing %s by default" % self._current) return self._cache[name], name
def _print_link(self, path, rc): if rc == 0: name = path + ".png" logger.info('<a href="%s"><img src="%s"></a>' % (name, name), True) else: logger.debug("Message sequence generation with seqdiag failed. Linking sequence file instead.") logger.info('<a href="%s">Message sequence</a>' % path, True)
def _print_link(self, path, rc): if rc == 0: name = path + '.png' logger.info('<a href="%s"><img src="%s"></a>' % (name, name), True) else: logger.debug( 'Message sequence generation with seqdiag failed. Linking sequence file instead.' ) logger.info('<a href="%s">Message sequence</a>' % path, True)
def _receive(self, nodes, *parameters): configs, message_fields, header_fields = self._get_parameters_with_defaults(parameters) node, name = nodes.get_with_name(configs.pop('name', None)) msg = node.get_message(self._get_message_template(), **configs) try: yield msg, message_fields, header_fields self._register_receive(node, self._current_container.name, name) logger.debug("Received %s" % repr(msg)) except AssertionError, e: self._register_receive(node, self._current_container.name, name, error=e.args[0]) raise e
def _receive(self, nodes, *parameters): configs, message_fields, header_fields = self._get_parameters_with_defaults( parameters) node, name = nodes.get_with_name(configs.pop('name', None)) msg = node.get_message(self._get_message_template(), **configs) try: yield msg, message_fields, header_fields self._register_receive(node, self._current_container.name, name) logger.debug("Received %s" % repr(msg)) except AssertionError, e: self._register_receive(node, self._current_container.name, name, error=e.args[0]) raise e
def log_receive(self, binary, ip, port): logger.debug("Trying to read %d bytes: %s from %s:%s over %s" % (len(binary), to_hex(binary), ip, port, self._transport_layer_name))
def log_send(self, binary, ip, port): logger.debug("Send %d bytes: %s to %s:%s over %s" % (len(binary), to_hex(binary), ip, port, self._transport_layer_name))
def _encode_message(self, message_fields, header_fields): msg = self._get_message_template().encode(message_fields, header_fields) logger.debug('%s' % repr(msg)) return msg