Sha256: df8afbed437033177ac4b965b85571b524f830c3bcb2a13e63845fd648f56db0

Contents?: true

Size: 489 Bytes

Versions: 3

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'] || 'error').upcase.to_sym
      ::Logger.const_defined?(l) ? ::Logger.const_get(l) : ::Logger::ERROR
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lambda_punch-0.0.8 lib/lambda_punch/logger.rb
lambda_punch-0.0.7 lib/lambda_punch/logger.rb
lambda_punch-0.0.6 lib/lambda_punch/logger.rb