Method: Vagrant::UI::Colored#format_message

Defined in:
lib/vagrant/ui.rb

#format_message(type, message, opts = nil) ⇒ Object

This is called by say to format the message for output.



151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/vagrant/ui.rb', line 151

def format_message(type, message, opts=nil)
  # Get the format of the message before adding color.
  message = super

  # Colorize the message if there is a color for this type of message,
  # either specified by the options or via the default color map.
  if opts.has_key?(:color)
    color   = COLORS[opts[:color]]
    message = "#{color}#{message}#{COLORS[:clear]}"
  else
    message = "#{COLOR_MAP[type]}#{message}#{COLORS[:clear]}" if COLOR_MAP[type]
  end

  message
end