Class: Proscenium::LogSubscriber

Inherits:
ActiveSupport::LogSubscriber
  • Object
show all
Defined in:
lib/proscenium/log_subscriber.rb

Instance Method Summary collapse

Instance Method Details

#build_to_path(event) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/proscenium/log_subscriber.rb', line 13

def build_to_path(event)
  path = event.payload[:identifier]
  cached = event.payload[:cached] ? ' | Cached!' : ''
  path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)

  info do
    message = "  #{color('[Proscenium]', nil, bold: true)} Building (to path) #{path}"
    message << " (Duration: #{event.duration.round(1)}ms | " \
               "Allocations: #{event.allocations}#{cached})"
  end
end

#build_to_string(event) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/proscenium/log_subscriber.rb', line 25

def build_to_string(event)
  path = event.payload[:identifier]
  path = CGI.unescape(path) if path.start_with?(/https?%3A%2F%2F/)

  info do
    message = "  #{color('[Proscenium]', nil, bold: true)} Building #{path}"
    message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
  end
end

#sideload(event) ⇒ Object



7
8
9
10
11
# File 'lib/proscenium/log_subscriber.rb', line 7

def sideload(event)
  info do
    "  [Proscenium] Side loaded #{event.payload[:identifier]}"
  end
end