Sha256: 67dd07098f6d6a11cdf6ffc7eadd9676cbb730bf156da65419581f6b555d279e

Contents?: true

Size: 489 Bytes

Versions: 4

Compression:

Stored size: 489 Bytes

Contents

module LambdaPunch
  class Logger

    def logger
      @logger ||= ::Logger.new(STDOUT).tap do |l| 
        l.level = level
        l.formatter = proc { |_s, _d, _p, m| "[LambdaPunch] #{m}\n" }
      end
    end

    def level=(value)
      @level = value.to_s
      @logger = nil
    end

    private

    def level
      l = (@level || ENV['LAMBDA_PUNCH_LOG_LEVEL'] || 'fatal').upcase.to_sym
      ::Logger.const_defined?(l) ? ::Logger.const_get(l) : ::Logger::FATAL
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lambda_punch-0.0.5 lib/lambda_punch/logger.rb
lambda_punch-0.0.4 lib/lambda_punch/logger.rb
lambda_punch-0.0.3 lib/lambda_punch/logger.rb
lambda_punch-0.0.2 lib/lambda_punch/logger.rb