Sha256: b49fb9f24263b0e21a49382db57f66969220b72cc97196cdf5e7ad5c53f558da

Contents?: true

Size: 568 Bytes

Versions: 28

Compression:

Stored size: 568 Bytes

Contents

# encoding: UTF-8

require 'logger'
require 'git-whistles'

module Git::Whistles
  class Logger < ::Logger
    Colors = {
      'DEBUG'   => :reset,
      'INFO'    => :green,
      'WARN'    => :yellow,
      'ERROR'   => :red,
      'FATAL'   => :red,
      'UNKNOWN' => :red
    }
    
    def initialize(*args)
      super
      self.formatter = self.method(:custom_formatter)
    end

    def custom_formatter(severity, time, progname, msg)
      msg = msg.sub(/([^¬])$/,"\\1\n").sub(/¬$/,'')
      Term::ANSIColor.send(Colors[severity], msg)
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
git-whistles-1.4.2 lib/git-whistles/logger.rb
git-whistles-1.4 lib/git-whistles/logger.rb
git-whistles-1.3 lib/git-whistles/logger.rb
git-whistles-1.2.1 lib/git-whistles/logger.rb
git-whistles-1.2.0 lib/git-whistles/logger.rb
git-whistles-1.1.3 lib/git-whistles/logger.rb
git-whistles-1.1.2 lib/git-whistles/logger.rb
git-whistles-1.1.1 lib/git-whistles/logger.rb
git-whistles-1.1.0 lib/git-whistles/logger.rb
git-whistles-1.0.2 lib/git-whistles/logger.rb
git-whistles-1.0.1 lib/git-whistles/logger.rb
git-whistles-0.12.0 lib/git-whistles/logger.rb
git-whistles-0.10.0 lib/git-whistles/logger.rb
git-whistles-0.9.1 lib/git-whistles/logger.rb
git-whistles-0.9.0 lib/git-whistles/logger.rb
git-whistles-0.8.2 lib/git-whistles/logger.rb
git-whistles-0.8.1 lib/git-whistles/logger.rb
git-whistles-0.8.0 lib/git-whistles/logger.rb
git-whistles-0.7.7 lib/git-whistles/logger.rb
git-whistles-0.7.6 lib/git-whistles/logger.rb