about summary refs log tree commit homepage
path: root/ext
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2012-11-02 20:09:28 -0700
committerEric Wong <normalperson@yhbt.net>2012-11-02 20:09:28 -0700
commitaaf1279e3e73e301b8f65b651933ebe287b82b4d (patch)
treeaf080b511188bb86869a107831b350deafc2b71a /ext
parent4bcd56a4f02b8a167d28505182cc6ff723fb027c (diff)
downloadclogger-aaf1279e3e73e301b8f65b651933ebe287b82b4d.tar.gz
avoid calling "<<" on env["rack.errors"]
Rack::Lint::ErrorWrapper forbids the "<<" method.  This
fallback only comes into play when no log destination
(via :logger or :path) is specified and is rarely an
issue in real setups.
Diffstat (limited to 'ext')
-rw-r--r--ext/clogger_ext/clogger.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c
index 857ed9a..04359f9 100644
--- a/ext/clogger_ext/clogger.c
+++ b/ext/clogger_ext/clogger.c
@@ -119,6 +119,7 @@ struct clogger {
         int reentrant; /* tri-state, -1:auto, 1/0 true/false */
 };
 
+static ID write_id;
 static ID ltlt_id;
 static ID call_id;
 static ID each_id;
@@ -687,9 +688,12 @@ static VALUE cwrite(struct clogger *c)
         } else {
                 VALUE logger = c->logger;
 
-                if (NIL_P(logger))
+                if (NIL_P(logger)) {
                         logger = rb_hash_aref(c->env, g_rack_errors);
-                rb_funcall(logger, ltlt_id, 1, dst);
+                        rb_funcall(logger, write_id, 1, dst);
+                } else {
+                        rb_funcall(logger, ltlt_id, 1, dst);
+                }
         }
 
         return Qnil;
@@ -1036,6 +1040,7 @@ void Init_clogger_ext(void)
 
         check_clock();
 
+        write_id = rb_intern("write");
         ltlt_id = rb_intern("<<");
         call_id = rb_intern("call");
         each_id = rb_intern("each");