Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] add console commands to get/set loglevel
@ 2010-01-04 19:19 Rich Lane
  2010-01-05 21:33 ` William Morgan
  0 siblings, 1 reply; 2+ messages in thread
From: Rich Lane @ 2010-01-04 19:19 UTC (permalink / raw)
  To: sup-devel

---
 lib/sup/logger.rb             |    3 ++-
 lib/sup/modes/console-mode.rb |    4 ++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/lib/sup/logger.rb b/lib/sup/logger.rb
index ccaeae0..ab97e47 100644
--- a/lib/sup/logger.rb
+++ b/lib/sup/logger.rb
@@ -14,13 +14,14 @@ class Logger
 
   def initialize level=nil
     level ||= ENV["SUP_LOG_LEVEL"] || "info"
-    @level = LEVELS.index(level) or raise ArgumentError, "invalid log level #{level.inspect}: should be one of #{LEVELS * ', '}"
+    self.level = level
     @mutex = Mutex.new
     @buf = StringIO.new
     @sinks = []
   end
 
   def level; LEVELS[@level] end
+  def level=(level); @level = LEVELS.index(level) || raise(ArgumentError, "invalid log level #{level.inspect}: should be one of #{LEVELS * ', '}"); end
 
   def add_sink s, copy_current=true
     @mutex.synchronize do
diff --git a/lib/sup/modes/console-mode.rb b/lib/sup/modes/console-mode.rb
index e9bf47c..8ea8f38 100644
--- a/lib/sup/modes/console-mode.rb
+++ b/lib/sup/modes/console-mode.rb
@@ -21,6 +21,10 @@ class Console
 
   def xapian; Index.instance.instance_variable_get :@xapian; end
   def ferret; Index.instance.instance_variable_get :@index; end
+
+  def loglevel; Redwood::Logger.level; end
+  def set_loglevel(level); Redwood::Logger.level = level; end
+
   def special_methods; methods - Object.methods end
 
   ## files that won't cause problems when reloaded
-- 
1.6.3.3

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


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

end of thread, other threads:[~2010-01-05 21:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-04 19:19 [sup-devel] [PATCH] add console commands to get/set loglevel Rich Lane
2010-01-05 21:33 ` William Morgan

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