diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-10 14:12:08 +0200 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-08-10 14:12:08 +0200 |
commit | e4f33c1ea92b56b09c6e58514c73b9a65bf09922 (patch) | |
tree | ddea2376a8fe05519b854700fc794eb59919257f /lib/rbot | |
parent | eebdc6973a6ab1089ed18c0ea02e72cd6e656120 (diff) |
irclog core module: skip, don't die when unable to open logfile
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/irclog.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/rbot/core/irclog.rb b/lib/rbot/core/irclog.rb index 61fdc561..706a5a7a 100644 --- a/lib/rbot/core/irclog.rb +++ b/lib/rbot/core/irclog.rb @@ -272,10 +272,15 @@ class IrcLogModule < CoreBotModule end end fp = logfilepath(where_str, now) - FileUtils.mkdir_p File.dirname(fp) - f = File.new(fp, "a") - f.sync = true - f.puts "[#{stamp}] @ Log started by #{@bot.myself.nick}" + begin + FileUtils.mkdir_p File.dirname(fp) + f = File.new(fp, "a") + f.sync = true + f.puts "[#{stamp}] @ Log started by #{@bot.myself.nick}" + rescue Exception => e + error e + next + end @logs[where_str] = [now, f] end @logs[where_str][1].puts "[#{stamp}] #{message}" |