about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2010-06-06 00:43:34 +0000
committerEric Wong <normalperson@yhbt.net>2010-06-06 05:19:34 +0000
commitbc1d1df38d7803ce9fdae05fc5129051eeed89e0 (patch)
treefda0e314119f27ed3ea4aa6848d653e2ff0070ed /lib
parente4c3548e8ff4c95c697b4a30699e6f655d60f188 (diff)
downloadclogger-bc1d1df38d7803ce9fdae05fc5129051eeed89e0.tar.gz
We no longer write the log out at the end of the body.each call.
This is a behavioral change, but fortunately all Rack servers
I've seen call body.close inside an ensure.

This allows us to later pass along the "to_path" method
and not rely on "each" to write the log.
Diffstat (limited to 'lib')
-rw-r--r--lib/clogger/pure.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/clogger/pure.rb b/lib/clogger/pure.rb
index e9a8e6a..50e4f6e 100644
--- a/lib/clogger/pure.rb
+++ b/lib/clogger/pure.rb
@@ -43,12 +43,13 @@ class Clogger
       @body_bytes_sent += Rack::Utils.bytesize(part)
       yield part
     end
-    ensure
-      log(@env, @status, @headers)
+    self
   end
 
   def close
     @body.close if @body.respond_to?(:close)
+    ensure
+      log(@env, @status, @headers)
   end
 
   def reentrant?