Sha256: fa5f07f9820280efcaae0b620f137824111de054967a2c45d00328ae55f4bfe8

Contents?: true

Size: 773 Bytes

Versions: 6

Compression:

Stored size: 773 Bytes

Contents

class RoquaLoggingRailtie < Rails::Railtie
  config.after_initialize do |app|
    RoquaLoggingRailtie.configure
  end

  class << self
    def configure
      Roqua.logger = ActiveSupport::Logger.new(output_stream).tap do |logger|
        logger.formatter = Logger::Formatter.new
        # Set the datetime_format to include timezone and use milliseconds instead of microseconds
        logger.formatter.datetime_format = '%Y-%m-%dT%H:%M:%S.%L%z '
      end

      require 'roqua/support/request_logger'
      Roqua::Support::RequestLogger.attach_to :action_controller
    end

    def output_stream
      if ENV['RAILS_LOG_TO_STDOUT_USING_ROQUA_LOGGER'].present?
        STDOUT
      else
        Rails.root.join("log/#{Rails.env}-events.log")
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
roqua-support-0.4.6 lib/roqua/logging/roqua_logging_railtie.rb
roqua-support-0.4.5 lib/roqua/logging/roqua_logging_railtie.rb
roqua-support-0.4.4 lib/roqua/logging/roqua_logging_railtie.rb
roqua-support-0.4.3 lib/roqua/logging/roqua_logging_railtie.rb
roqua-support-0.4.2 lib/roqua/logging/roqua_logging_railtie.rb
roqua-support-0.4.1 lib/roqua/logging/roqua_logging_railtie.rb