Class: Sq::Dbsync::Loggers::NullWithCallbacks
- Defined in:
- lib/sq/dbsync/loggers.rb
Overview
Logging is one of the few outputs of the system, this class is provided as a cheap way to allow tests to hook into events. It should not be used in production.
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
Returns the value of attribute callbacks.
Instance Method Summary collapse
-
#initialize(callbacks = nil) ⇒ NullWithCallbacks
constructor
A new instance of NullWithCallbacks.
- #measure(label, &block) ⇒ Object
Methods inherited from Abstract
Constructor Details
#initialize(callbacks = nil) ⇒ NullWithCallbacks
Returns a new instance of NullWithCallbacks.
126 127 128 |
# File 'lib/sq/dbsync/loggers.rb', line 126 def initialize(callbacks = nil) @callbacks = callbacks end |
Instance Attribute Details
#callbacks ⇒ Object
Returns the value of attribute callbacks.
124 125 126 |
# File 'lib/sq/dbsync/loggers.rb', line 124 def callbacks @callbacks end |
Instance Method Details
#measure(label, &block) ⇒ Object
130 131 132 133 |
# File 'lib/sq/dbsync/loggers.rb', line 130 def measure(label, &block) (callbacks || {}).fetch(label, ->{}).call block.call end |