lib/shog/formatter.rb
# Provide default formatting for messages of the given severity when
# a {#match} is not found.
#
# @overload severity( level, proc )
#   @param [String,Symbol] level to format.
#   @param [#call(msg)] proc that receives the message and returns the
#     reformatted message.
# @overload severity( level )
#   @param [String,Symbol] level to format.
#   @yieldparam msg [String] the message to reformat.
#   @yieldreturn [String] the reformatted message.
#
# @return [Formatter] self.
#
# @example
#   configure do
#     severity(:fatal){ |msg| msg.white_on_red }
#   end
Provide default formatting for messages of the given severity when
a {#match} is not found.
Provide default formatting for messages of the given severity when a { #match } is not found .
def severity( level, proc = nil, &block )
      proc ||= block
      configuration[:severities][ level.to_s.upcase ] = proc
      self
    end
def severity ( level , proc = nil , & block ) proc ||= block configuration [ :severities ] [ level . to_s . upcase ] = proc self end
Provide default formatting for messages of the given severity when
a {#match} is not found.
Provide default formatting for messages of the given severity when a { #match } is not found .
None
Formatter
level
<not_specific>
proc
<not_specific>
block
<not_specific>
overload
severity( level, proc ) @param [String,Symbol] level to format. @param [#call(msg)] proc that receives the message and returns the reformatted message.
severity ( level proc ) @param [ String Symbol ] level to format . @param [ #call ( msg ) ] proc that receives the message and returns the reformatted message .
overload
severity( level ) @param [String,Symbol] level to format. @yieldparam msg [String] the message to reformat. @yieldreturn [String] the reformatted message.
severity ( level ) @param [ String Symbol ] level to format . @yieldparam msg [ String ] the message to reformat . @yieldreturn [ String ] the reformatted message .
example
configure do severity(:fatal){ |msg| msg.white_on_red } end
configure do severity ( : fatal ) { |msg| msg . white_on_red } end