Sha256: 00893c3e96d3c5a659c05f8fd15eaddcfa3306be559204da453682c171b2c7c2

Contents?: true

Size: 484 Bytes

Versions: 7

Compression:

Stored size: 484 Bytes

Contents

require 'logger'

module GeekDict
  class Debugger

    def initialize(enable=false)
      @enable = enable
      @logger    = new_logger if enable
    end

    def debug(msg)
       @logger.debug msg if @enable
    end


    private

    def new_logger()
      Logger.new(STDOUT).tap do |l|
        l.datetime_format = '%Y-%m-%dT%H:%M:%S%z'
        l.formatter = proc do |severity, datetime, progname, msg|
          "#{datetime} : #{msg}\n"
        end
      end
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
geekdict-0.1.1 lib/geekdict/debugger.rb
geekdict-0.1.0 lib/geekdict/debugger.rb
geekdict-0.0.6 lib/geekdict/debugger.rb
geekdict-0.0.5 lib/geekdict/debugger.rb
geekdict-0.0.4 lib/geekdict/debugger.rb
geekdict-0.0.3 lib/geekdict/debugger.rb
geekdict-0.0.2 lib/geekdict/debugger.rb