lib/shog/formatter.rb
# Format the severity indicator tagged before each line. To format the
# actual message itself use {#severity}.
#
# @overload severity_tag( level, proc )
#   @param [String,Symbol] level to format.
#   @param [#call(level)] proc that receives the log level and returns the
#     reformatted level.
#
# @overload severity_tag( level )
#   @param [String,Symbol] level to format.
#   @yieldparam level [String] the log level to reformat.
#   @yieldreturn [String] the reformatted level.
#
# @return [Formatter] self.
#
# @example
#   configure do
#     severity_tag(:warn){|level| level.yellow }
#     severity_tag(:error){|level| level.red }
#   end
Format the severity indicator tagged before each line. To format the
actual message itself use {#severity}.
Format the severity indicator tagged before each line . To format the actual message itself use { #severity } .
def severity_tag( level, proc = nil, &block )
      proc ||= block
      configuration[:severity_tags][ level.to_s.upcase ] = proc
      self
    end
def severity_tag ( level , proc = nil , & block ) proc ||= block configuration [ :severity_tags ] [ level . to_s . upcase ] = proc self end
Format the severity indicator tagged before each line.
Format the severity indicator tagged before each line .
None
Formatter
level
<not_specific>
proc
<not_specific>
block
<not_specific>
overload
severity_tag( level, proc ) @param [String,Symbol] level to format. @param [#call(level)] proc that receives the log level and returns the reformatted level.
severity_tag ( level proc ) @param [ String Symbol ] level to format . @param [ #call ( level ) ] proc that receives the log level and returns the reformatted level .
overload
severity_tag( level ) @param [String,Symbol] level to format. @yieldparam level [String] the log level to reformat. @yieldreturn [String] the reformatted level.
severity_tag ( level ) @param [ String Symbol ] level to format . @yieldparam level [ String ] the log level to reformat . @yieldreturn [ String ] the reformatted level .
example
None