Class: Trifle::Logger::Configuration
- Inherits:
-
Object
- Object
- Trifle::Logger::Configuration
- Defined in:
- lib/trifle/logger/configuration.rb
Instance Attribute Summary collapse
-
#bump_every ⇒ Object
Returns the value of attribute bump_every.
-
#callbacks ⇒ Object
Returns the value of attribute callbacks.
-
#tracer_class ⇒ Object
Returns the value of attribute tracer_class.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #on(event, &block) ⇒ Object
- #on_bump(tracer) ⇒ Object
- #on_liftoff(tracer) ⇒ Object
- #on_wrapup(tracer) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 12 |
# File 'lib/trifle/logger/configuration.rb', line 8 def initialize @tracer_class = Trifle::Logger::Tracer::Hash @callbacks = { liftoff: [], bump: [], wrapup: [] } @bump_every = 15.seconds end |
Instance Attribute Details
#bump_every ⇒ Object
Returns the value of attribute bump_every.
6 7 8 |
# File 'lib/trifle/logger/configuration.rb', line 6 def bump_every @bump_every end |
#callbacks ⇒ Object
Returns the value of attribute callbacks.
6 7 8 |
# File 'lib/trifle/logger/configuration.rb', line 6 def callbacks @callbacks end |
#tracer_class ⇒ Object
Returns the value of attribute tracer_class.
6 7 8 |
# File 'lib/trifle/logger/configuration.rb', line 6 def tracer_class @tracer_class end |
Instance Method Details
#on(event, &block) ⇒ Object
32 33 34 |
# File 'lib/trifle/logger/configuration.rb', line 32 def on(event, &block) @callbacks[event] << block end |
#on_bump(tracer) ⇒ Object
20 21 22 23 24 |
# File 'lib/trifle/logger/configuration.rb', line 20 def on_bump(tracer) @callbacks.fetch(:bump, []).map do |c| c.call(tracer) end end |
#on_liftoff(tracer) ⇒ Object
14 15 16 17 18 |
# File 'lib/trifle/logger/configuration.rb', line 14 def on_liftoff(tracer) @callbacks.fetch(:liftoff, []).map do |c| c.call(tracer) end end |
#on_wrapup(tracer) ⇒ Object
26 27 28 29 30 |
# File 'lib/trifle/logger/configuration.rb', line 26 def on_wrapup(tracer) @callbacks.fetch(:wrapup, []).map do |c| c.call(tracer) end end |