Sha256: 4792f2209d49e6a96b21e80193a113dcf8d8550d4500f1656bf2b63b2617ff88

Contents?: true

Size: 720 Bytes

Versions: 19

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

require 'active_support/log_subscriber'

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

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

      info do
        message = +"[Proscenium] Building #{path}"
        message << " (Duration: #{event.duration.round(1)}ms | Allocations: #{event.allocations})"
        message << "\n" if defined?(Rails.env) && Rails.env.development?
      end
    end
  end
end

Proscenium::LogSubscriber.attach_to :proscenium

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
proscenium-0.9.1-x86_64-linux lib/proscenium/log_subscriber.rb
proscenium-0.9.1-aarch64-linux lib/proscenium/log_subscriber.rb
proscenium-0.9.1-arm64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.9.1-x86_64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.9.0-x86_64-linux lib/proscenium/log_subscriber.rb
proscenium-0.9.0-aarch64-linux lib/proscenium/log_subscriber.rb
proscenium-0.9.0-arm64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.9.0-x86_64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.8.2-x86_64-linux lib/proscenium/log_subscriber.rb
proscenium-0.8.2-aarch64-linux lib/proscenium/log_subscriber.rb
proscenium-0.8.2-arm64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.8.2-x86_64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.8.0-aarch64-linux lib/proscenium/log_subscriber.rb
proscenium-0.8.0-arm64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.8.0-x86_64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.7.0-x86_64-linux lib/proscenium/log_subscriber.rb
proscenium-0.7.0-aarch64-linux lib/proscenium/log_subscriber.rb
proscenium-0.7.0-arm64-darwin lib/proscenium/log_subscriber.rb
proscenium-0.7.0-x86_64-darwin lib/proscenium/log_subscriber.rb