Sha256: 39bae44d2bcd666ff27b2b686a9205d32aee430ba51228d87e1eccd953046d81

Contents?: true

Size: 541 Bytes

Versions: 9

Compression:

Stored size: 541 Bytes

Contents

#!/usr/bin/env falcon --verbose serve -c
# frozen_string_literal: true

require 'async'

class RequestLogger
	def initialize(app)
		@app = app
	end
	
	def call(env)
		logger = Async.logger.with(level: :debug, name: "middleware")
		
		Async(logger: logger) do
			@app.call(env)
		end.wait
	end
end

use RequestLogger

run lambda {|env|
	start_time = Async::Clock.now
	
	server_timing = ->{
		"app;dur=#{Async::Clock.now - start_time}"
	}
	
	[
		200,
		[["trailers", "server-timing"], ["server-timing", server_timing]],
		["Hello World"]
	]
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
falcon-0.36.4 examples/trailers/config.ru
falcon-0.36.3 examples/trailers/config.ru
falcon-0.36.2 examples/trailers/config.ru
falcon-0.36.1 examples/trailers/config.ru
falcon-0.36.0 examples/trailers/config.ru
falcon-0.35.6 examples/trailers/config.ru
falcon-0.35.5 examples/trailers/config.ru
falcon-0.35.4 examples/trailers/config.ru
falcon-0.35.3 examples/trailers/config.ru