summary refs log tree commit
diff options
context:
space:
mode:
-rw-r--r--lib/rack/nulllogger.rb9
-rw-r--r--test/spec_rack_nulllogger.rb2
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/rack/nulllogger.rb b/lib/rack/nulllogger.rb
index a5a2fac4..77fb637d 100644
--- a/lib/rack/nulllogger.rb
+++ b/lib/rack/nulllogger.rb
@@ -1,5 +1,14 @@
 module Rack
   class NullLogger
+    def initialize(app)
+      @app = app
+    end
+
+    def call(env)
+      env['rack.logger'] = self
+      @app.call(env)
+    end
+
     def info(progname = nil, &block);  end
     def debug(progname = nil, &block); end
     def warn(progname = nil, &block);  end
diff --git a/test/spec_rack_nulllogger.rb b/test/spec_rack_nulllogger.rb
index b14a200a..b3c2bc9c 100644
--- a/test/spec_rack_nulllogger.rb
+++ b/test/spec_rack_nulllogger.rb
@@ -8,6 +8,6 @@ context "Rack::NullLogger" do
       env['rack.logger'].warn "b00m"
       [200, {'Content-Type' => 'text/plain'}, ["Hello, World!"]]
     }
-    app.call({'rack.logger' => Rack::NullLogger.new})
+    Rack::NullLogger.new(app).call({})
   end
 end