summaryrefslogtreecommitdiff
path: root/lib/rbot/ircbot.rb
diff options
context:
space:
mode:
authorMatthias Hecker <apoc@sixserv.org>2013-11-14 13:41:16 +0000
committerMatthias Hecker <apoc@sixserv.org>2013-11-14 13:41:16 +0000
commitc4d629ad86aae3b8bb4669650df57875252bea92 (patch)
treebf0b1408052b13b9b0b05c6662dd802b700b29ca /lib/rbot/ircbot.rb
parent85ee9672fce67d95bf8310af331a576f3492b863 (diff)
always print FATAL and ERROR logmessages to STDERR
This adds a print to $stderr for log messages with the level ERROR or FATAL. I did this because in the past errors connecting to the server weren't immediately obvious but rather hidden in the logfile. I think it should be right in-your-face when the connection doesn't work. It would probaply be better to extend Logger to print to STDERR but this apparently requires monkeypatching ruby's Logger. Anyhow I think my solution works for now.
Diffstat (limited to 'lib/rbot/ircbot.rb')
-rw-r--r--lib/rbot/ircbot.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index a1713c2d..108d0b1d 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -66,6 +66,10 @@ def rawlog(level, message=nil, who_pos=1)
qmsg.push [level, l.chomp, who]
who = ' ' * who.size
}
+ # Also output (fatal) errors to STDERR:
+ if level == Logger::Severity::ERROR or level == Logger::Severity::FATAL
+ $stderr.puts str
+ end
$log_queue.push qmsg
end