Class: ActiveProfiling::ActionController::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- ActiveProfiling::ActionController::LogSubscriber
- Defined in:
- lib/active-profiling/action_controller/log_subscriber.rb
Instance Method Summary collapse
- #gc_statistics(event) ⇒ Object
- #logger ⇒ Object
- #profiler_output(event) ⇒ Object
- #profiler_output_to_file(event) ⇒ Object
Instance Method Details
#gc_statistics(event) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/active-profiling/action_controller/log_subscriber.rb', line 26 def gc_statistics(event) return unless logger&.send("#{config.gc_statistics.log_level}?") return if event.payload[:report].blank? title = event.payload[:title] report = indent(event.payload[:report]) logger.send( config.gc_statistics.log_level, "#{color("GC Statistics: #{title}", YELLOW, bold: true)}\n#{report}" ) end |
#logger ⇒ Object
40 41 42 |
# File 'lib/active-profiling/action_controller/log_subscriber.rb', line 40 def logger ::Rails.logger end |
#profiler_output(event) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/active-profiling/action_controller/log_subscriber.rb', line 5 def profiler_output(event) return unless logger&.send("#{config.profiler.log_level}?") report = indent(event.payload[:profiler_output]) title = event.payload[:title] logger.send( config.profiler.log_level, "#{color("Profiler Output: #{title}", YELLOW, bold: true)}\n#{report}" ) end |
#profiler_output_to_file(event) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/active-profiling/action_controller/log_subscriber.rb', line 17 def profiler_output_to_file(event) return unless logger&.send("#{config.profiler.log_level}?") logger.send( config.profiler.log_level, color("Wrote profiling information to #{event.payload[:file_name]}", YELLOW, bold: true) ) end |