Class: Huebot::Logging::CollectingLogger
- Inherits:
-
Object
- Object
- Huebot::Logging::CollectingLogger
- Defined in:
- lib/huebot/logging/collecting_logger.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Instance Method Summary collapse
-
#initialize ⇒ CollectingLogger
constructor
A new instance of CollectingLogger.
- #log(event_type, data = {}) ⇒ Object
Constructor Details
#initialize ⇒ CollectingLogger
Returns a new instance of CollectingLogger.
6 7 8 9 |
# File 'lib/huebot/logging/collecting_logger.rb', line 6 def initialize @events = [] @mut = Mutex.new end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
4 5 6 |
# File 'lib/huebot/logging/collecting_logger.rb', line 4 def events @events end |
Instance Method Details
#log(event_type, data = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/huebot/logging/collecting_logger.rb', line 11 def log(event_type, data = {}) now = Time.now @mut.synchronize { @events << [now, event_type, data] } self end |