class Aviator::Logger

Public Class Methods

configure(log_file_path) click to toggle source
# File lib/aviator/core/logger.rb, line 33
def self.configure(log_file_path)
  # Return a subclass with its logfile path set. This
  # must be done so that different sessions can log to
  # different paths.
  Class.new(self) { const_set('LOG_FILE_PATH', log_file_path) }
end
new(app, logger=nil) click to toggle source
Calls superclass method
# File lib/aviator/core/logger.rb, line 6
def initialize(app, logger=nil)
  super(app)
  @logger = logger || begin
    require 'logger'
    ::Logger.new(self.class::LOG_FILE_PATH)
  end
end

Public Instance Methods

call(env) click to toggle source
Calls superclass method
# File lib/aviator/core/logger.rb, line 18
def call(env)
  info(env[:method].to_s.upcase) { env[:url].to_s }
  debug('REQ_HEAD') { dump_headers env[:request_headers] }
  debug('REQ_BODY') { dump_body env[:body] }
  super
end
on_complete(env) click to toggle source
# File lib/aviator/core/logger.rb, line 26
def on_complete(env)
  info('STATUS') { env[:status].to_s }
  debug('RES_HEAD') { dump_headers env[:response_headers] }
  debug('RES_BODY') { dump_body env[:body] }
end