examples/hello/config.ru in falcon-0.31.0 vs examples/hello/config.ru in falcon-0.32.0
- old
+ new
@@ -1,3 +1,21 @@
#!/usr/bin/env falcon --verbose serve -c
-run lambda {|env| [200, {}, ["Hello World"]]}
+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| Async.logger.debug(self) {env['HTTP_USER_AGENT']}; [200, {}, ["Hello World"]]}