<commit_before>require 'pakyow/core/app'
require 'pakyow/core/logger/request_logger'

module Pakyow
  module Middleware
    # Rack middleware used for logging during the request / response lifecycle.
    #
    # @api private
    class Logger
      Pakyow::App.middleware do |builder|
        if Pakyow::Config.logger.enabled
          builder.use Pakyow::Middleware::Logger
        end
      end

      Pakyow::CallContext.after :error do
        logger.houston(req.error)
      end

      def initialize(app)
        @app = app
      end

      def call(env)
        logger = Pakyow::Logger::RequestLogger.new(:http)
        env['rack.logger'] = logger

        logger.prologue(env)
        result = @app.call(env)
        logger.epilogue(result)

        result
      end
    end
  end
end
<commit_msg>Always load logger middleware<commit_after>require 'pakyow/core/app'
require 'pakyow/core/logger/request_logger'

module Pakyow
  module Middleware
    # Rack middleware used for logging during the request / response lifecycle.
    #
    # @api private
    class Logger
      Pakyow::App.middleware do |builder|
        builder.use Pakyow::Middleware::Logger
      end

      Pakyow::CallContext.after :error do
        logger.houston(req.error)
      end

      def initialize(app)
        @app = app
      end

      def call(env)
        logger = Pakyow::Logger::RequestLogger.new(:http)
        env['rack.logger'] = logger

        logger.prologue(env)
        result = @app.call(env)
        logger.epilogue(result)

        result
      end
    end
  end
end

{'fraction_non_alphanumeric': 0.08922880815806246, 'fraction_numerical': 0.0, 'mean_word_length': 2.250517598343685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1208933', 'n_tokens_mistral': 487, 'n_tokens_neox': 475, 'n_words': 112}