Sha256: 75dd92ce0a212ad2e098094cc3f66fea37ec8e8f255f936e3d25fda2cf9d5009

Contents?: true

Size: 465 Bytes

Versions: 3

Compression:

Stored size: 465 Bytes

Contents

require 'colorize'

module Autowow
  class LogFormatter
    def self.beautify(severity, msg)
      log_msg = msg.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.3.0 lib/autowow/log_formatter.rb
autowow-0.2.0 lib/autowow/log_formatter.rb
autowow-0.1.0 lib/autowow/log_formatter.rb