Sha256: 4afc24b8f0f3f584b5a956dc35d3cac990ea78497482c8608010a4499304baef

Contents?: true

Size: 992 Bytes

Versions: 7

Compression:

Stored size: 992 Bytes

Contents

module Logtail
  module Frameworks
    # Module for Rails specific code, such as the Railtie and any methods that assist
    # with Rails setup.
    module Rails
      # Installs Logtail into your Rails app automatically.
      class Railtie < ::Rails::Railtie
        railtie_name 'logtail-rails'

        config.logtail = Config.instance

        config.before_initialize do
          Logtail::Config.instance.logger = Proc.new { ::Rails.logger }
        end

        # Must be loaded after initializers so that we respect any Logtail configuration set
        initializer(:logtail, before: :build_middleware_stack, after: :load_config_initializers) do
          Integrations::Rails.integrate!

          # Install the Rack middlewares so that we capture structured data instead of
          # raw text logs.
          Integrations::Rails.middlewares.collect do |middleware_class|
            config.app_middleware.use middleware_class
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
logtail-rails-0.2.8 lib/logtail-rails/railtie.rb
logtail-rails-0.2.7 lib/logtail-rails/railtie.rb
logtail-rails-0.2.6 lib/logtail-rails/railtie.rb
logtail-rails-0.2.5 lib/logtail-rails/railtie.rb
logtail-rails-0.2.4 lib/logtail-rails/railtie.rb
logtail-rails-0.2.3 lib/logtail-rails/railtie.rb
logtail-rails-0.2.2 lib/logtail-rails/railtie.rb