Class: LambdaPunch::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/lambda_punch/logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLogger

Returns a new instance of Logger.



6
7
8
# File 'lib/lambda_punch/logger.rb', line 6

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

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



4
5
6
# File 'lib/lambda_punch/logger.rb', line 4

def level
  @level
end

Instance Method Details

#loggerObject



10
11
12
13
14
15
# File 'lib/lambda_punch/logger.rb', line 10

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