Module: FakeDynamo::Logger

Defined in:
lib/fake_dynamo/logger.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.logObject

Returns the value of attribute log.



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

def log
  @log
end

Class Method Details

.setup(level) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/fake_dynamo/logger.rb', line 6

def setup(level)
  logger = ::Logger.new(STDOUT)
  logger.level = [:debug, :info, :warn, :error, :fatal].index(level)
  logger.formatter = proc do |severity, datetime, progname, msg|
    "#{msg}\n"
  end

  def logger.pp(object)
    return if level > ::Logger::INFO
    output = ''
    PP.pp(object, output)
    info(output)
  end

  @log = logger
end