Class: Cased::Instrumentation::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Cased::Instrumentation::LogSubscriber
- Defined in:
- lib/cased/instrumentation/log_subscriber.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.events ⇒ Object
12 13 14 |
# File 'lib/cased/instrumentation/log_subscriber.rb', line 12 def self.events Thread.current['cased_events'] ||= 0 end |
.events=(value) ⇒ Object
8 9 10 |
# File 'lib/cased/instrumentation/log_subscriber.rb', line 8 def self.events=(value) Thread.current['cased_events'] = value end |
.reset_events ⇒ Object
16 17 18 |
# File 'lib/cased/instrumentation/log_subscriber.rb', line 16 def self.reset_events self.events = 0 end |
Instance Method Details
#audit_event(event) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/cased/instrumentation/log_subscriber.rb', line 20 def audit_event(event) self.class.events += 1 event = JSON.generate(event.payload[:event]) name = color('Cased', CYAN, true) debug " #{name} #{event}" end |