Class: Huebot::Logging::IOLogger
- Inherits:
-
Object
- Object
- Huebot::Logging::IOLogger
- Defined in:
- lib/huebot/logging/io_logger.rb
Instance Method Summary collapse
-
#initialize(io) ⇒ IOLogger
constructor
A new instance of IOLogger.
- #log(event_type, data = {}) ⇒ Object
Constructor Details
#initialize(io) ⇒ IOLogger
Returns a new instance of IOLogger.
6 7 8 9 |
# File 'lib/huebot/logging/io_logger.rb', line 6 def initialize(io) @io = io @mut = Mutex.new end |
Instance Method Details
#log(event_type, data = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/huebot/logging/io_logger.rb', line 11 def log(event_type, data = {}) ts = Time.now.iso8601 @mut.synchronize { @io.puts "#{ts} #{event_type} #{data.to_json}" } end |