Class: DebugLogging::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- DebugLogging::LogSubscriber
- Defined in:
- lib/debug_logging/log_subscriber.rb
Constant Summary collapse
- EVENT_FORMAT_STRING =
'%<name>s (%<duration>.3f secs) start=%<time>s end=%<end>s payload=%<payload>s'
Class Attribute Summary collapse
-
.event ⇒ Object
Returns the value of attribute event.
Class Method Summary collapse
Class Attribute Details
.event ⇒ Object
Returns the value of attribute event.
8 9 10 |
# File 'lib/debug_logging/log_subscriber.rb', line 8 def event @event end |
Class Method Details
.event_to_format_options(event) ⇒ Hash
25 26 27 28 29 30 31 32 33 |
# File 'lib/debug_logging/log_subscriber.rb', line 25 def self.(event) { name: event.name, duration: Rational(event.duration, 1000).to_f, time: event.time, end: event.end, payload: event.payload } end |
.log_event(event) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/debug_logging/log_subscriber.rb', line 14 def self.log_event(event) @event = event if event.payload && event.payload[:exception_object] exception = event.payload[:exception_object] "#{event.name} [ERROR] : \n#{exception.class} : #{exception.message}\n" + exception.backtrace.join("\n") end format(EVENT_FORMAT_STRING, (event)) end |