class Falcon::Verbose

def annotate(request)

def annotate(request)
	task = Async::Task.current
	address = request.remote_address
	
	@logger.debug(request.authority) {"#{request.method} #{request.path} #{request.version} from #{address.inspect}"}
	
	# if ENV['REQUEST_HEADERS']
	# 	@logger.debug(request.authority) {request.headers.inspect}
	# end
	
	task.annotate("#{request.method} #{request.path} from #{address.inspect}")
end

def call(request)

def call(request)
	annotate(request)
	
	statistics = Async::HTTP::Statistics.start
	
	response = super
	
	statistics.wrap(response) do |statistics, error|
		@logger.info(request.authority) {"#{request.method} #{request.path} #{request.version} -> #{response.status}; #{statistics.inspect}"}
		
		# if ENV['RESPONSE_HEADERS']
		# 	@logger.info response.headers.inspect
		# end
		
		@logger.error(request.authority) {"#{error.class}: #{error.message}"} if error
	end
	
	return response
end

def initialize(app, logger = Async.logger)

def initialize(app, logger = Async.logger)
	super(app)
	
	@logger = logger
end