Subject: Re: [sup-devel] How do I force flush the log file in sup?

From: Gaute Hope <[email-masked]>
Date: Sat, 10 Aug 2013 00:18:56 +0200

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

---

From: Horacio Sanson <[email-masked]>
Date: Tue, 30 Jul 2013 22:18:27 +0900

regards,
Horacio
_______________________________________________
Sup-devel mailing list
[email-masked]
http://rubyforge.org/mailman/listinfo/sup-devel