Sha256: 855768c8f1bcf1c41a4cffcb049d785078a12996bc3f4803f8fcf5d003322a43

Contents?: true

Size: 483 Bytes

Versions: 9

Compression:

Stored size: 483 Bytes

Contents

module LambdaPunch
  class Logger

    attr_reader :level

    def initialize
      @level = (ENV['LAMBDA_PUNCH_LOG_LEVEL'] || 'error').upcase.to_sym
    end

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

    private

    def logger_level
      ::Logger.const_defined?(@level) ? ::Logger.const_get(@level) : ::Logger::ERROR
    end

  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
lambda_punch-1.1.4 lib/lambda_punch/logger.rb
lambda_punch-1.1.3 lib/lambda_punch/logger.rb
lambda_punch-1.1.2 lib/lambda_punch/logger.rb
lambda_punch-1.1.1 lib/lambda_punch/logger.rb
lambda_punch-1.1.0 lib/lambda_punch/logger.rb
lambda_punch-1.0.3 lib/lambda_punch/logger.rb
lambda_punch-1.0.2 lib/lambda_punch/logger.rb
lambda_punch-1.0.1 lib/lambda_punch/logger.rb
lambda_punch-1.0.0 lib/lambda_punch/logger.rb