Formats the message according to the configured {#match} blocks.

 @param [String] msg to format.
 @return [String] the formatted message.
423513
def formatted_message( severity, msg )
      msg = String === msg ? msg : msg.inspect

      if args = _matched( msg )
        args.first.call msg, args.last
      elsif proc = configuration[:severities][severity]
        proc.call msg
      else
        msg
      end
    end
788738
def format(self):
        
        message = ""
        if self.paragraphs:
            if self.header:
                message += (self.header + '\n\n')
            message += "\n\n".join(self.paragraphs)
            if self.footer:
                message += ('\n\n' + self.footer)
        return message
113666
def unstyle msg
      styles.map do |_,v|
        v[:match]
      end.flatten.inject(msg) do |m, tag|
        m.gsub(tag, '')
      end
    end
409255
function(msg) {
        var nick_hex, time_difference,
            message_words,
            sb = this.model.get('scrollback'),
            network = this.model.get('network'),
            nick,
            regexpStr,
            prev_msg = sb[sb.length-2],
            hour, pm, am_pm_locale_key;

        // Clone the msg object so we dont modify the original
        msg = _.clone(msg);

        // Defaults
        msg.css_classes = '';
        msg.nick_style = '';
        msg.is_highlight = false;
        msg.time_string = '';

        // Nick + custom highlight detecting
        nick = network ? network.get('nick') : '';
        if (nick && msg.nick.localeCompare(nick) !== 0) {
            // Build a list of all highlights and escape them for regex
            regexpStr = _.chain((_kiwi.global.settings.get('custom_highlights') || '').split(/[\s,]+/))
                .compact()
                .concat(nick)
                .map(_.escapeRegExp)
                .join('|')
                .value();

            if (msg.msg.search(new RegExp('(\\b|\\W|^)(' + regexpStr + ')(\\b|\\W|$)', 'i')) > -1) {
                msg.is_highlight = true;
                msg.css_classes += ' highlight';
            }
        }

        message_words = msg.msg.split(' ');
        message_words = _.map(message_words, function(word) {
            var parsed_word;

            parsed_word = this.parseMessageUrls(word);
            if (typeof parsed_word === 'string') return parsed_word;

            parsed_word = this.parseMessageChannels(word);
            if (typeof parsed_word === 'string') return parsed_word;

            parsed_word = this.parseMessageNicks(word, (msg.type === 'privmsg'));
            if (typeof parsed_word === 'string') return parsed_word;

            parsed_word = _.escape(word);

            // Replace text emoticons with images
            if (_kiwi.global.settings.get('show_emoticons')) {
                parsed_word = emoticonFromText(parsed_word);
            }

            return parsed_word;
        }, this);

        msg.unparsed_msg = msg.msg;
        msg.msg = message_words.join(' ');

        // Convert IRC formatting into HTML formatting
        msg.msg = formatIRCMsg(msg.msg);

        // Add some style to the nick
        msg.nick_style = this.getNickStyles(msg.nick).asCssString();

        // Generate a hex string from the nick to be used as a CSS class name
        nick_hex = '';
        if (msg.nick) {
            _.map(msg.nick.split(''), function (char) {
                nick_hex += char.charCodeAt(0).toString(16);
            });
            msg.css_classes += ' nick_' + nick_hex;
        }

        if (prev_msg) {
            // Time difference between this message and the last (in minutes)
            time_difference = (msg.time.getTime() - prev_msg.time.getTime())/1000/60;
            if (prev_msg.nick === msg.nick && time_difference < 1) {
                msg.css_classes += ' repeated_nick';
            }
        }

        // Build up and add the line
        if (_kiwi.global.settings.get('use_24_hour_timestamps')) {
            msg.time_string = msg.time.getHours().toString().lpad(2, "0") + ":" + msg.time.getMinutes().toString().lpad(2, "0") + ":" + msg.time.getSeconds().toString().lpad(2, "0");
        } else {
            hour = msg.time.getHours();
            pm = hour > 11;

            hour = hour % 12;
            if (hour === 0)
                hour = 12;

            am_pm_locale_key = pm ?
                'client_views_panel_timestamp_pm' :
                'client_views_panel_timestamp_am';

            msg.time_string = translateText(am_pm_locale_key, hour + ":" + msg.time.getMinutes().toString().lpad(2, "0") + ":" + msg.time.getSeconds().toString().lpad(2, "0"));
        }

        return msg;
    }
20692
def extract_to(rails_message, format: :full)
      to = complex_extract(rails_message.to.first)
      return to[:value] if to[:decoded]

      case format
      when :full
        rails_message[:to].formatted.first
      when :name
        rails_message[:to].address_list.addresses.first.name
      when :address
        rails_message[:to].address_list.addresses.first.address
      end
    end
771561
def Msg(validator, message):
    
    @wraps(Msg)
    def built(value):
        try:
            return validator(value)
        except Error as e:
            e.message = message
            raise e
    return built
770268
def next_message
      message = nil

      if block_given?
        index = @messages.index do |msg|
          yield(msg) || msg.is_a?(SystemEvent)
        end

        message = @messages.slice!(index, 1).first if index
      else
        message = @messages.shift
      end

      message
    end
770663
def _format_msg(self, msg, edata):
        """"""
        edata = edata if isinstance(edata, list) else [edata]
        for fdict in edata:
            if "*[{token}]*".format(token=fdict["field"]) not in msg:
                raise RuntimeError(
                    "Field {token} not in exception message".format(
                        token=fdict["field"]
                    )
                )
            msg = msg.replace(
                "*[{token}]*".format(token=fdict["field"]), "{value}"
            ).format(value=fdict["value"])
        return msg
290942
def _ReformatMessageString(self, message_string):
    
    def _PlaceHolderSpecifierReplacer(match_object):
      """Replaces message string place holders into Python format() style."""
      expanded_groups = []
      for group in match_object.groups():
        try:
          place_holder_number = int(group, 10) - 1
          expanded_group = '{{{0:d}:s}}'.format(place_holder_number)
        except ValueError:
          expanded_group = group

        expanded_groups.append(expanded_group)

      return ''.join(expanded_groups)

    if not message_string:
      return None

    message_string = self._WHITE_SPACE_SPECIFIER_RE.sub(r'', message_string)
    message_string = self._TEXT_SPECIFIER_RE.sub(r'\\\1', message_string)
    message_string = self._CURLY_BRACKETS.sub(r'\1\1', message_string)
    return self._PLACE_HOLDER_SPECIFIER_RE.sub(
        _PlaceHolderSpecifierReplacer, message_string)
702311
function (msg) {
        msg = this.cleanWhiteSpace(msg);
        msg = msg.replace(/%\([a-zA-Z0-9_.|]+\)s/g, function (variable_name) {
            var name = variable_name.substring(2, (variable_name.length - 2));
            return '{' + name + '}';
        });
        msg = msg.replace(/%\([a-zA-Z0-9_.|]+\)d/g, function (variable_name) {
            var name = variable_name.substring(2, (variable_name.length - 2));
            return '{' + name + ', number}';
        });
        msg = msg.replace(/%(d|i)/g, '{digit, number}');
        msg = msg.replace(/%s/g, '{string}');
        return msg;
    }
306611
def sms(*args)
      message = ''
      options = {}
      args.each do |arg|
        case arg
        when String
          message = arg
        when Hash
          options.merge!(arg)
        else
          raise ArgumentError, 'sms expects STring or Hash argument'
        end
      end

      output { @xml.Sms(message, options) }
    end
1190074
def say msg, *styles
      self.write((color?? process(msg, *styles) : unstyle(msg)) + "\n") ; nil
    end
479568
def format(self, message_format):
        
        if message_format not in self.formats:
            self._log.error('Invalid Message format specified: {format}'.format(format=message_format))
            return

        self._log.debug('Setting message format to {format}'.format(format=message_format))
        self._format = message_format
527999
def msg(self, message, title=None, title_color=None, color='BLUE', ident=0):
        '''
        
        '''
        if title and not title_color:
            title_color = color
        if title_color and not title:
            title_color = None

        self.__colored_output(title, message, title_color, color, ident=ident)
725320
def _sendMessage(self, msg):
        
        if not msg:
            return
        msg = self._collapseMsg(msg)
        self.sendStatus(msg)
558462
public static String formatMessage(String msgKey) {
        String msg;
        try {
            msg = JaxbToolsConstants.messages.getString(msgKey);
        } catch (Exception ex) {
            // no FFDC required
            return msgKey;
        }

        return msg;
    }
1270204
def message
      return {} unless params[:_message]
      begin
        Marshal.load(Merb::Parse.unescape(params[:_message]).unpack("m").first)
      rescue ArgumentError, TypeError
        {}
      end
    end