Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] How do I force flush the log file in sup?
@ 2013-07-30 13:18 Horacio Sanson
  2013-08-09 22:18 ` Gaute Hope
  0 siblings, 1 reply; 2+ messages in thread
From: Horacio Sanson @ 2013-07-30 13:18 UTC (permalink / raw)
  To: Sup developer discussion


[-- Attachment #1.1: Type: text/plain, Size: 237 bytes --]

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?

regards,
Horacio

[-- Attachment #1.2: Type: text/html, Size: 293 bytes --]

[-- Attachment #2: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [sup-devel] How do I force flush the log file in sup?
  2013-07-30 13:18 [sup-devel] How do I force flush the log file in sup? Horacio Sanson
@ 2013-08-09 22:18 ` Gaute Hope
  0 siblings, 0 replies; 2+ messages in thread
From: Gaute Hope @ 2013-08-09 22:18 UTC (permalink / raw)
  To: Sup developer discussion; +Cc: Horacio Sanson

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-09 22:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-30 13:18 [sup-devel] How do I force flush the log file in sup? Horacio Sanson
2013-08-09 22:18 ` Gaute Hope

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox