Sha256: 37646798e9348ffc631e246d55d0ba17aa098eac6448d453a8ae118ebb68fba4

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

require 'colorize'

module Autowow
  class LogFormatter
    def self.beautify(severity, msg)
      log_msg = msg.to_s.end_with?($/) ? msg : "#{msg}#{$/}"
      log_msg = " $ #{log_msg}" if severity.eql?('DEBUG')
      color(severity, log_msg)
    end

    def self.color(severity, msg)
      case severity
      when 'DEBUG'
        msg.yellow
      when 'WARN'
        msg.light_red
      when 'ERROR'
        msg.red
      else
        msg
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
autowow-0.5.0 lib/autowow/log_formatter.rb
autowow-0.4.1 lib/autowow/log_formatter.rb
autowow-0.4.0 lib/autowow/log_formatter.rb