Sha256: 2ddf39b16312cd73c41d6d6be6d68492df31a58ec4ffe6f6d0f082e7094dc57f

Contents?: true

Size: 1.1 KB

Versions: 63

Compression:

Stored size: 1.1 KB

Contents

# require "eitil_wrapper/request_logger/controller_mixin"

require_relative "logger_job"

module EitilWrapper
  module RequestLogger
    module ControllerMixin

      private

      def log_request
        $request_logger_path ||= "#{Rails.root}/log/request_logger.log"
        EitilWrapper::RequestLogger::LoggerJob.perform_later(request_logger_object)
      end
      
      def request_logger_object
        
        log_request = {
          path:       request.env["REQUEST_PATH"],
          method:     request.env["REQUEST_METHOD"],
          query_str:  request.env["QUERY_STRING"], 
        }
       
        log_params = {
          params:     params.as_json
        }

        log_attributes = {
          time:       Time.now.strftime("%Y-%m-%d %H:%M:%S")
        }

        log = {
          request:    log_request,
          params:     log_params,
          attributes: log_attributes
        }

        log_time = log_attributes[:time]
        log_strf = log.deep_symbolize_keys.to_s   
        # log_strf may be hashed through eval(log_strf)

        return log_strf
      end    
   
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
eitil-2.0.2 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-2.0.1 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-2.0.0 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.4.1 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.4.0 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.12 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.11 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.10 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.9 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.8 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.7 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.6 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.5 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.4 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.3 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.2 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.1 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.3.0 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.2.4 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb
eitil-1.2.3 eitil_wrapper/lib/eitil_wrapper/request_logger/controller_mixin.rb