summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmitry kim <jason@nichego.net>2008-04-15 23:07:02 +0400
committerdmitry kim <jason@nichego.net>2008-04-15 23:07:02 +0400
commite86335936a37b372cbdff4b106ba32aff0a0e9dc (patch)
tree119526b7f483774c57473fc4f473608fc3378161
parentc3c62ed2f838cdd79a2f26571cbd18642398905c (diff)
+ ircbot logging: atomic multiline log records
-rw-r--r--lib/rbot/ircbot.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb
index 7def98b5..4dcc91fc 100644
--- a/lib/rbot/ircbot.rb
+++ b/lib/rbot/ircbot.rb
@@ -20,9 +20,9 @@ $logger.level = 0 if $debug
$log_queue = Queue.new
Thread.new do
- l = nil
- while l = $log_queue.pop
- $logger.add(*l)
+ ls = nil
+ while ls = $log_queue.pop
+ ls.each { |l| $logger.add(*l) }
end
end
@@ -63,10 +63,12 @@ def rawlog(level, message=nil, who_pos=1)
else
str = message.pretty_inspect
end
+ qmsg = Array.new
str.each_line { |l|
- $log_queue.push [level, l.chomp, who]
+ qmsg.push [level, l.chomp, who]
who = ' ' * who.size
}
+ $log_queue.push qmsg
end
def log_session_start