Class: Startback::Support::FakeLogger

Inherits:
Logger
  • Object
show all
Defined in:
lib/startback/support/fake_logger.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Logger

#error, #fatal, level=, #warn

Constructor Details

#initialize(*args) ⇒ FakeLogger

Returns a new instance of FakeLogger.



5
6
7
# File 'lib/startback/support/fake_logger.rb', line 5

def initialize(*args)
  @seen = []
end

Instance Attribute Details

#formatterObject

Returns the value of attribute formatter.



8
9
10
# File 'lib/startback/support/fake_logger.rb', line 8

def formatter
  @formatter
end

#seenObject (readonly)

Returns the value of attribute seen.



9
10
11
# File 'lib/startback/support/fake_logger.rb', line 9

def seen
  @seen
end

Instance Method Details

#format(severity, message) ⇒ Object



21
22
23
24
25
# File 'lib/startback/support/fake_logger.rb', line 21

def format(severity, message)
  return message unless formatter

  formatter.call(severity.to_s.upcase, Time.now, 'prognam', message)
end

#last_msgObject



11
12
13
# File 'lib/startback/support/fake_logger.rb', line 11

def last_msg
  seen.last
end