lib/shog/formatter.rb
# Formats the severity indicator prefixed before each line when writing to
# the log.
#
# @param [String] the severity of the message (ex DEBUG, WARN, etc.)
# @return [String] formatted version of the severity
Formats the severity indicator prefixed before each line when writing to
the log.
Formats the severity indicator prefixed before each line when writing to the log .
def formatted_severity_tag( severity )
      length = configuration[:severity_tags][:_length] ||= begin
        configuration[:severity_tags].reduce(0){ |l,(k,_)| [k.length,l].max }
      end
      return if length == 0
      padded_severity = severity.ljust length
      formatted = if proc = configuration[:severity_tags][severity]
                    proc.call padded_severity
                  else
                    padded_severity
                  end
      _tagged formatted, :severity_tags
    end
def formatted_severity_tag ( severity ) length = configuration [ :severity_tags ] [ :_length ] ||= begin configuration [ :severity_tags ] . reduce ( 0 ) { | l , ( k , _ ) | [ k . length , l ] . max } end return if length == 0 padded_severity = severity . ljust length formatted = if proc = configuration [ :severity_tags ] [ severity ] proc . call padded_severity else padded_severity end _tagged formatted , :severity_tags end
Formats the severity indicator prefixed before each line when writing to
the log.
Formats the severity indicator prefixed before each line when writing to the log .
formatted version of the severity
formatted version of the severity
String
severity
<not_specific>
<not_specific>
the severity of the message (ex DEBUG, WARN, etc.)
the severity of the message ( ex DEBUG WARN etc . )