Class: Thrifty::Logger::Context
- Inherits:
-
Object
- Object
- Thrifty::Logger::Context
- Defined in:
- lib/thrifty/logger/context.rb
Instance Attribute Summary collapse
-
#level ⇒ Object
Returns the value of attribute level.
Instance Method Summary collapse
- #[]=(k, v) ⇒ Object
-
#initialize(app, scope, context = nil) ⇒ Context
constructor
A new instance of Context.
- #measure(message, payload = {}) ⇒ Object
Constructor Details
Instance Attribute Details
#level ⇒ Object
Returns the value of attribute level.
4 5 6 |
# File 'lib/thrifty/logger/context.rb', line 4 def level @level end |
Instance Method Details
#[]=(k, v) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/thrifty/logger/context.rb', line 17 def []=(k,v) if v == nil @context.delete(k) else @context[k] = v end end |
#measure(message, payload = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/thrifty/logger/context.rb', line 25 def measure(, payload = {}) tm = Time.now.to_f re = nil re = yield if block_given? tm = Time.now.to_f - tm payload[:duration] = tm self.info , payload re end |