Class: Logfoo::Timed
- Inherits:
-
Struct
- Object
- Struct
- Logfoo::Timed
- Defined in:
- lib/logfoo/timed.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source
1 2 3 |
# File 'lib/logfoo/timed.rb', line 1 def source @source end |
Instance Method Details
#benchmark(level, message, payload, block) ⇒ Object
2 3 4 5 6 7 8 9 10 |
# File 'lib/logfoo/timed.rb', line 2 def benchmark(level, , payload, block) payload ||= {} time_start = Time.now.to_f reply = source._call_log_fn(block, payload) payload.merge!(duration: Time.now.to_f - time_start) source.public_send(level, , payload) reply end |