Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Gaute Hope <eg@gaute.vetsj.com>
To: Sup developer discussion <sup-devel@rubyforge.org>
Cc: Horacio Sanson <hsanson@gmail.com>
Subject: Re: [sup-devel] How do I force flush the log file in sup?
Date: Sat, 10 Aug 2013 00:18:56 +0200	[thread overview]
Message-ID: <52056AD0.1070807@gaute.vetsj.com> (raw)
In-Reply-To: <CAHWBo_bM_WmaUUHbER+1V8=o_McxibJCCipnxKnepsviV8Rrhw@mail.gmail.com>

On 30. juli 2013 15:18, Horacio Sanson wrote:
> Is there a way to force sup to flush the log file after each write? It is
> difficult to debug my gmail source as I cannot see real time what is going
> on. Maybe set sup to always flush when SUP_LOG_LEVEL is set to debug?

See below, you can add an check for log level as well if you want.

- gaute

diff --git a/lib/sup/logger.rb b/lib/sup/logger.rb
index 7dd296a..283dfdb 100644
--- a/lib/sup/logger.rb
+++ b/lib/sup/logger.rb
@@ -60,7 +60,10 @@ private
   ## actually distribute the message
   def send_message m
     @mutex.synchronize do
-      @sinks.each { |sink| sink << m }
+      @sinks.each do |sink|
+        sink << m
+        sink.flush if sink.respond_to? :flush
+      end
       @buf << m
     end
   end


      reply	other threads:[~2013-08-09 22:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 13:18 Horacio Sanson
2013-08-09 22:18 ` Gaute Hope [this message]

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

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

  git send-email \
    --in-reply-to=52056AD0.1070807@gaute.vetsj.com \
    --to=eg@gaute.vetsj.com \
    --cc=hsanson@gmail.com \
    --cc=sup-devel@rubyforge.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox