Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
From: Rich Lane <rlane@club.cc.cmu.edu>
To: sup-devel@rubyforge.org
Subject: [sup-devel] [PATCH] add console commands to get/set loglevel
Date: Mon,  4 Jan 2010 11:19:40 -0800	[thread overview]
Message-ID: <1262632780-3661-1-git-send-email-rlane@club.cc.cmu.edu> (raw)

---
 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


             reply	other threads:[~2010-01-04 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-04 19:19 Rich Lane [this message]
2010-01-05 21:33 ` William Morgan

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=1262632780-3661-1-git-send-email-rlane@club.cc.cmu.edu \
    --to=rlane@club.cc.cmu.edu \
    --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