clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <bofh@yhbt.net>
To: clogger-public@yhbt.net
Subject: [PATCH] doc: document Fiber.current
Date: Mon, 10 Aug 2020 22:23:44 +0000	[thread overview]
Message-ID: <20200810222344.15138-1-bofh@yhbt.net> (raw)

It's always been supported (since it's just an eval), but make
it explicit.  We'll also drop the Actor.current example since
both Rubinius and Revactor seem dead and Ractor (Guild) is
probably coming...
---
 README               |  2 +-
 test/test_clogger.rb | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/README b/README
index c90dd1a..cdb8fba 100644
--- a/README
+++ b/README
@@ -89,7 +89,7 @@ that receives a "<<" method:
 * $ip - X-Forwarded-For request header if available, $remote_addr if not
 * $pid - process ID of the current process
 * $e{Thread.current} - Thread processing the request
-* $e{Actor.current} - Actor processing the request (Revactor or Rubinius)
+* $e{Fiber.current} - Fiber processing the request
 * $env{variable_name} - any Rack environment variable (e.g. rack.url_scheme)
 
 == REQUIREMENTS
diff --git a/test/test_clogger.rb b/test/test_clogger.rb
index b7dd4e9..1dee652 100644
--- a/test/test_clogger.rb
+++ b/test/test_clogger.rb
@@ -212,6 +212,22 @@ class TestClogger < Test::Unit::TestCase
     assert_equal "-#{current}-\n", str.string
   end
 
+  def test_fiber
+    begin
+      current = Fiber.current.to_s
+    rescue NameError => e
+      warn "your Ruby does not support fibers #{e}"
+      return
+    end
+    str = StringIO.new
+    app = lambda { |env| [ 302, {}, [] ] }
+    cl = Clogger.new(app,
+                    :logger => str,
+                    :format => "-$e{Fiber.current}-\n")
+    status, headers, body = cl.call(@req)
+    assert_equal "-#{current}-\n", str.string
+  end
+
   def test_pid
     str = StringIO.new
     app = lambda { |env| [ 302, {}, [] ] }

                 reply	other threads:[~2020-08-10 22:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/clogger/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200810222344.15138-1-bofh@yhbt.net \
    --to=bofh@yhbt.net \
    --cc=clogger-public@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/clogger.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).