module Roby::DRoby::EventLogging
Mixin to add event-logging related functionality to a class
The class must provide a event_logger object. It must be non-nil, and can be initialized with {NullEventLogger} for a no-op logger
Public Instance Methods
log(m, *args)
click to toggle source
Log an event on the underlying logger
# File lib/roby/droby/event_logging.rb, line 9 def log(m, *args) event_logger.dump(m, Time.now, args) end
log_flush_cycle(m, *args)
click to toggle source
# File lib/roby/droby/event_logging.rb, line 50 def log_flush_cycle(m, *args) event_logger.flush_cycle(m, Time.now, args) end
log_queue_size()
click to toggle source
The amount of cycles pending in the {#event_logger}'s dump queue
# File lib/roby/droby/event_logging.rb, line 46 def log_queue_size event_logger.log_queue_size end
log_timepoint(name)
click to toggle source
Log a timepoint on the underlying logger
# File lib/roby/droby/event_logging.rb, line 14 def log_timepoint(name) current_thread = Thread.current event_logger.dump_timepoint(:timepoint, Time.now, [current_thread.droby_id, current_thread.name, name]) end
log_timepoint_group(name) { || ... }
click to toggle source
Run a block within a timepoint group
# File lib/roby/droby/event_logging.rb, line 20 def log_timepoint_group(name) log_timepoint_group_start(name) yield ensure log_timepoint_group_end(name) end
log_timepoint_group_end(name)
click to toggle source
End a timepoint group
The logger will NOT do any validation of the group start/end pairing at logging time. This is done at replay time
# File lib/roby/droby/event_logging.rb, line 40 def log_timepoint_group_end(name) current_thread = Thread.current event_logger.dump_timepoint(:timepoint_group_end, Time.now, [current_thread.droby_id, current_thread.name, name]) end
log_timepoint_group_start(name)
click to toggle source
Log a timepoint on the underlying logger
The logger will NOT do any validation of the group start/end pairing at logging time. This is done at replay time
# File lib/roby/droby/event_logging.rb, line 31 def log_timepoint_group_start(name) current_thread = Thread.current event_logger.dump_timepoint(:timepoint_group_start, Time.now, [current_thread.droby_id, current_thread.name, name]) end