Sha256: 7d337e9a2f4d56b6b721d02ea19bea07b880df5c693187f56ea43cfd9035754d

Contents?: true

Size: 805 Bytes

Versions: 15

Compression:

Stored size: 805 Bytes

Contents

require 'logger'
require 'dply/ext/string'
module Dply
  class CustomLogger < ::Logger

    attr_writer :trace_mode, :remote_mode

    def initialize(file)
      super(file)
      @level = ::Logger::INFO
    end

    def format_message(severity, timestamp, progname, msg)
      case severity
      when "INFO"
        "#{msg}\n"
      when "ERROR"
        "#{severity.bold.red} #{msg}\n"
      when "WARN"
        "#{severity.downcase.bold.yellow} #{msg}\n"
      else
        "#{severity[0].bold.blue} #{msg}\n"
      end
    end

    def bullet(msg)
      puts "#{"\u2219".bold.blue} #{msg}"
    end

    def trace(msg)
      return if not @trace_mode
      puts %(#{"T".bold.blue} #{msg}\n)
    end

    def remote(msg)
      return if not @remote_mode
      puts %{dply_msg|#{msg}}
    end

  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
dply-0.1.13 lib/dply/custom_logger.rb
dply-0.1.12 lib/dply/custom_logger.rb
dply-0.1.11 lib/dply/custom_logger.rb
dply-0.1.10 lib/dply/custom_logger.rb
dply-0.1.9 lib/dply/custom_logger.rb
dply-0.1.8 lib/dply/custom_logger.rb
dply-0.1.7 lib/dply/custom_logger.rb
dply-0.1.6 lib/dply/custom_logger.rb
dply-0.1.5 lib/dply/custom_logger.rb
dply-0.1.4 lib/dply/custom_logger.rb
dply-0.1.2 lib/dply/custom_logger.rb
dply-0.1.1 lib/dply/custom_logger.rb
dply-0.1.0 lib/dply/custom_logger.rb
dply-0.0.8 lib/dply/custom_logger.rb
dply-0.0.7 lib/dply/custom_logger.rb