Class: Proscenium::LogSubscriber
- Inherits:
-
ActiveSupport::LogSubscriber
- Object
- ActiveSupport::LogSubscriber
- Proscenium::LogSubscriber
- Defined in:
- lib/proscenium/log_subscriber.rb
Instance Method Summary collapse
Instance Method Details
#build(event) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/proscenium/log_subscriber.rb', line 18 def build(event) path = event.payload[:identifier] path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/) info do = " #{color('[Proscenium]', nil, bold: true)} Building /#{path}" << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})" end end |
#resolve(event) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/proscenium/log_subscriber.rb', line 28 def resolve(event) path = event.payload[:identifier] path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/) info do = " #{color('[Proscenium]', nil, bold: true)} Resolving #{path}" << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})" end end |
#sideload(event) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/proscenium/log_subscriber.rb', line 7 def sideload(event) path = event.payload[:identifier] sideloaded = event.payload[:sideloaded] sideloaded = sideloaded.relative_path_from(Rails.root) if sideloaded.is_a?(Pathname) info do msg = " #{color('[Proscenium]', nil, bold: true)} Sideloading #{path}" sideloaded.is_a?(Pathname) ? msg << " from #{sideloaded}" : msg end end |